Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <stdio.h>
- int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
- char appPath[MAX_PATH] = {0};
- char appDir[MAX_PATH] = {0};
- char *cmd;
- size_t cmdSize;
- GetModuleFileName(NULL, appPath, MAX_PATH);
- strncpy(appDir, appPath, strrchr(appPath, '\\') - appPath);
- appDir[MAX_PATH - 1] = '\0';
- // 'cmd /S /C ""' + appdir + '\retropia.bat" ' + lpCmdLine + '"' + '\0'
- cmdSize = strlen(appDir) + strlen(lpCmdLine) + 29;
- cmd = (char *)calloc(cmdSize, sizeof(char));
- _snprintf_s(cmd, cmdSize, _TRUNCATE, "cmd /S /C \"\"%s\\retropia.bat\" %s\"", appDir, lpCmdLine);
- system(cmd);
- return 0;
- }
Add Comment
Please, Sign In to add comment