42 lines
942 B
C++
42 lines
942 B
C++
|
|
#include "Stdafx.h"
|
|||
|
|
#include <AfxDllx.h>
|
|||
|
|
|
|||
|
|
//<2F><><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
|||
|
|
#include <WinSock2.h>
|
|||
|
|
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|
|||
|
|
|
|||
|
|
static AFX_EXTENSION_MODULE KernelEngineDLL = {NULL, NULL};
|
|||
|
|
|
|||
|
|
//DLL <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
|
extern "C" int APIENTRY DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
|
|||
|
|
{
|
|||
|
|
UNREFERENCED_PARAMETER(lpReserved);
|
|||
|
|
if (dwReason == DLL_PROCESS_ATTACH)
|
|||
|
|
{
|
|||
|
|
if (!AfxInitExtensionModule(KernelEngineDLL, hInstance)) return 0;
|
|||
|
|
new CDynLinkLibrary(KernelEngineDLL);
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC> COM
|
|||
|
|
CoInitialize(NULL);
|
|||
|
|
|
|||
|
|
//<2F><>ʼ<EFBFBD><CABC> SOCKET
|
|||
|
|
WSADATA WSAData;
|
|||
|
|
WORD wVersionRequested = MAKEWORD(2, 2);
|
|||
|
|
int iErrorCode = WSAStartup(wVersionRequested, &WSAData);
|
|||
|
|
if (iErrorCode != 0) return 0;
|
|||
|
|
}
|
|||
|
|
else if (dwReason == DLL_PROCESS_DETACH)
|
|||
|
|
{
|
|||
|
|
WSACleanup();
|
|||
|
|
|
|||
|
|
CoUninitialize();
|
|||
|
|
AfxTermExtensionModule(KernelEngineDLL);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//////////////////////////////////////////////////////////////////////////
|