-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.c
More file actions
56 lines (46 loc) · 1.26 KB
/
main.c
File metadata and controls
56 lines (46 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Made by kraiser a.k.a. krisje8
#include <stdio.h>
#include <windows.h>
#include <winbase.h>
#include <process.h>
int xsystem(char *cmd, char *path, int wait)
{
PROCESS_INFORMATION pi;
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW | STARTF_FORCEOFFFEEDBACK;
si.wShowWindow = SW_HIDE;
if (CreateProcess(0, cmd, 0, 0, TRUE, 0, 0, path, &si, &pi) == 0)
return 1; /* FAILED */
if (wait) {
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
}
return 0; /* SUCCESS */
}
int main(){
//Let's get the logial drives first
char drivebuf[1024];
char path[1024];
char pathfile[1024];
int found = 0;
GetLogicalDriveStrings(1024, drivebuf);
char *pch = drivebuf;
//Iterate through them to see which one has our go.cmd
while (*pch) {
sprintf(path, "%sWIP\\CMD\\", pch);
sprintf(pathfile, "%sgo.cmd", path);
if(access(pathfile, "F_OK") == 0){
found = 1;
break;
}
pch = &pch[strlen(pch) + 1];
}
if(found == 1){
//Ok we found the drive letter of our U3 drive
xsystem(pathfile, path, 0);
}
return 0;
}