Guest User

Untitled

a guest
Jan 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <stdio.h>
  3.  
  4. int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
  5. char appPath[MAX_PATH] = {0};
  6. char appDir[MAX_PATH] = {0};
  7. char *cmd;
  8. size_t cmdSize;
  9.  
  10. GetModuleFileName(NULL, appPath, MAX_PATH);
  11.  
  12. strncpy(appDir, appPath, strrchr(appPath, '\\') - appPath);
  13. appDir[MAX_PATH - 1] = '\0';
  14.  
  15. // 'cmd /S /C ""' + appdir + '\retropia.bat" ' + lpCmdLine + '"' + '\0'
  16. cmdSize = strlen(appDir) + strlen(lpCmdLine) + 29;
  17. cmd = (char *)calloc(cmdSize, sizeof(char));
  18. _snprintf_s(cmd, cmdSize, _TRUNCATE, "cmd /S /C \"\"%s\\retropia.bat\" %s\"", appDir, lpCmdLine);
  19.  
  20. system(cmd);
  21.  
  22. return 0;
  23. }
Add Comment
Please, Sign In to add comment