Skip to content

Commit c66d79b

Browse files
Debugging loader app.
1 parent 15fefc3 commit c66d79b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

loader/main.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int main(int argc, char *argv[]) {
2121

2222
#define BUFFER_SIZE 8000
2323
DWORD buffer_size = BUFFER_SIZE;
24-
wchar_t buffer[BUFFER_SIZE];
24+
//wchar_t buffer[BUFFER_SIZE];
2525

2626
std::wstring config_path;
2727
std::wstring launch_path;
@@ -35,6 +35,7 @@ int main(int argc, char *argv[]) {
3535
}*/
3636

3737
buffer_size = BUFFER_SIZE;
38+
/*
3839
auto status = RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\elgato\\obs", L"",
3940
RRF_RT_REG_SZ, nullptr, buffer, &buffer_size);
4041
// Ignore if the value is too long for our buffer. The user can suffer if OBS is installed in a path longer than 8000 characters long
@@ -77,7 +78,7 @@ int main(int argc, char *argv[]) {
7778
7879
connect_attempts_remaining = 6;
7980
}
80-
81+
*/
8182

8283
std::string payload = argv[1];
8384

@@ -86,7 +87,7 @@ int main(int argc, char *argv[]) {
8687
std::string base_name = "\\\\.\\pipe\\" + pipe_name;
8788
std::string attempt_name;
8889
HANDLE pipe = INVALID_HANDLE_VALUE;
89-
90+
int connect_attempts_remaining = 6;
9091
while (connect_attempts_remaining-- > 0 &&
9192
pipe == INVALID_HANDLE_VALUE) {
9293
pipe_number = 0;
@@ -107,13 +108,15 @@ int main(int argc, char *argv[]) {
107108
}
108109
if (pipe == INVALID_HANDLE_VALUE) {
109110
printf("Could not open named pipe!");
111+
while (true) Sleep(100);
110112
return 1;
111113
}
112114
DWORD mode = PIPE_READMODE_MESSAGE;
113115
auto success = SetNamedPipeHandleState(pipe, &mode, NULL, NULL);
114116
if (!success) {
115117
CloseHandle(pipe);
116118
printf("Could not configure named pipe!");
119+
while (true) Sleep(100);
117120
return 1;
118121
}
119122

@@ -123,9 +126,10 @@ int main(int argc, char *argv[]) {
123126
if (!success || written < payload.size()) {
124127
printf("Failed to write to named pipe!");
125128
CloseHandle(pipe);
129+
while (true) Sleep(100);
126130
return 1;
127131
}
128-
129132
CloseHandle(pipe);
133+
while (true) Sleep(100);
130134
return 0;
131-
}
135+
}

0 commit comments

Comments
 (0)