Advertisement
TCPizza

Untitled

Dec 28th, 2018
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.78 KB | None | 0 0
  1.  
  2. #include <stdio.h>
  3. #include <Windows.h>
  4. #include <stdlib.h>
  5. int main(void)
  6. {
  7.  
  8.     STARTUPINFO StartupInfo;
  9.     memset(&StartupInfo, 0, sizeof(StartupInfo));
  10.     // set the size of the structure
  11.     StartupInfo.cb = sizeof(STARTUPINFO);
  12.     // tell the application that we are setting the window display
  13.     // information within this structure
  14.     StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
  15.     // set the window display to HIDE
  16.     StartupInfo.wShowWindow = SW_HIDE;
  17.  
  18.     printf("close me");
  19.     HKEY hkey = NULL;
  20.     RegCreateKey(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Run", &hkey);
  21.     RegSetValueEx(hkey, L"myapp", 0, REG_SZ, (BYTE*)path, (wcslen(path) + 1) * 2);
  22.     /* HEAP CORRUPTION
  23.     char* hello;
  24.     while (1)
  25.     {
  26.         hello = (char*)malloc(100);
  27.     }
  28.     */
  29.     getchar();
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement