· 4 years ago · Jan 08, 2021, 10:46 PM
1void __cdecl FUN_00401000(int param_1)
2
3{
4 byte bVar1;
5 char cVar2;
6 LPCWSTR *ppWVar3;
7 LPSTR *ppCVar4;
8 uint uVar5;
9 FILE *pFVar6;
10 int iVar7;
11 byte *pbVar8;
12 LPWSTR lpPathName;
13 byte *pbVar9;
14 uint uVar10;
15 char **ppcVar11;
16 byte *pbVar12;
17 undefined extraout_DL;
18 undefined extraout_DL_00;
19 undefined extraout_DL_01;
20 undefined extraout_DL_02;
21 undefined extraout_DL_03;
22 undefined extraout_DL_04;
23 undefined extraout_DL_05;
24 undefined extraout_DL_06;
25 undefined extraout_DL_07;
26 undefined extraout_DL_08;
27 undefined uVar13;
28 LPCSTR unaff_ESI;
29 char **ppcVar14;
30 bool bVar15;
31 int unaff_retaddr;
32 LPSTR *ppCStack00000008;
33 char *_Buffer;
34 CHAR in_stack_ffffcffc;
35
36 ppWVar3 = (LPCWSTR *)FUN_00409419();
37 ppCVar4 = (LPSTR *)FUN_00409413();
38 ppCVar4 = FUN_00404600(*ppCVar4,*ppWVar3,unaff_ESI,unaff_retaddr);
39 uVar5 = DAT_0042d008 ^ (uint)&stack0xffffcffc;
40 _Buffer = (char *)0x0;
41 ppCStack00000008 = ppCVar4;
42 pFVar6 = (FILE *)___acrt_iob_func(2);
43 _setbuf(pFVar6,_Buffer);
44 pFVar6 = (FILE *)FUN_00401770();
45 uVar13 = extraout_DL;
46 if ((((pFVar6 == (FILE *)0x0) ||
47 (iVar7 = FUN_004025f0(&stack0xffffcffc), uVar13 = extraout_DL_00, iVar7 == 0)) ||
48 (iVar7 = FUN_00402540(&stack0xffffeffc,&stack0xffffcffc), uVar13 = extraout_DL_01, iVar7 == 0)
49 ) || (iVar7 = thunk_FUN_00402580((undefined2 *)&stack0xffffdffc,&stack0xffffcffc),
50 uVar13 = extraout_DL_02, iVar7 == 0)) {
51 FUN_004075a4(uVar5 ^ (uint)&stack0xffffcffc,uVar13,in_stack_ffffcffc);
52 return;
53 }
54 pbVar8 = (byte *)FUN_00403b20("_MEIPASS2");
55 FUN_004040b0("_MEIPASS2");
56 iVar7 = FUN_00401690((FILE **)pFVar6,&stack0xffffcffc);
57 if ((iVar7 == 0) && (iVar7 = FUN_00401690((FILE **)pFVar6,&stack0xffffeffc), iVar7 == 0)) {
58 FUN_00401820("Cannot open self %s or archive %s\n");
59 FUN_004075a4(uVar5 ^ (uint)&stack0xffffcffc,extraout_DL_03,in_stack_ffffcffc);
60 return;
61 }
62 pFVar6[0x203]._charbuf = (int)ppCVar4;
63 pFVar6[0x203]._file = param_1;
64 if (pbVar8 == (byte *)0x0) {
65 iVar7 = FUN_00402030((int)pFVar6);
66 if (iVar7 == 0) {
67 pbVar8 = &stack0xffffdffc;
68 goto LAB_004023e6;
69 }
70 }
71 else {
72LAB_004023e6:
73 lpPathName = FUN_00404890((LPWSTR)0x0,(LPCSTR)pbVar8,0,unaff_ESI);
74 SetDllDirectoryW(lpPathName);
75 FID_conflict__free(lpPathName);
76 if (pbVar8 != (byte *)0x0) {
77 pbVar9 = &stack0xffffdffc;
78 pbVar12 = pbVar8;
79 do {
80 bVar1 = *pbVar9;
81 bVar15 = bVar1 < *pbVar12;
82 if (bVar1 != *pbVar12) {
83LAB_00402436:
84 uVar10 = -(uint)bVar15 | 1;
85 goto LAB_0040243b;
86 }
87 if (bVar1 == 0) break;
88 bVar1 = pbVar9[1];
89 bVar15 = bVar1 < pbVar12[1];
90 if (bVar1 != pbVar12[1]) goto LAB_00402436;
91 pbVar9 = pbVar9 + 2;
92 pbVar12 = pbVar12 + 2;
93 } while (bVar1 != 0);
94 uVar10 = 0;
95LAB_0040243b:
96 if (uVar10 != 0) {
97 ppcVar11 = &pFVar6[0x103]._base;
98 iVar7 = _snprintf((char *)ppcVar11,0x1000,"%s",pbVar8);
99 uVar13 = extraout_DL_04;
100 if (0xfff < iVar7) goto LAB_00402526;
101 pFVar6[0x203]._base = (char *)0x1;
102 ppcVar14 = ppcVar11;
103 do {
104 cVar2 = *(char *)ppcVar14;
105 ppcVar14 = (char **)((int)ppcVar14 + 1);
106 *(char *)((int)pFVar6 + (0x3067 - (int)ppcVar11) + (int)ppcVar14) = cVar2;
107 } while (cVar2 != '\0');
108 }
109 FUN_00401fa0((int)pFVar6);
110 FUN_00401e70((FILE **)pFVar6);
111 thunk_FUN_00403030((int)pFVar6);
112 uVar13 = extraout_DL_05;
113 goto LAB_00402526;
114 }
115 }
116 iVar7 = FUN_00401ed0(pFVar6);
117 uVar13 = extraout_DL_06;
118 if (iVar7 == 0) {
119 ppcVar11 = (char **)&stack0xffffdffc;
120 if (*(char *)&pFVar6[0x103]._base != '\0') {
121 ppcVar11 = &pFVar6[0x103]._base;
122 }
123 FUN_00404070("_MEIPASS2",(LPCSTR)ppcVar11);
124 FUN_00403b20("_MEIPASS2");
125 iVar7 = FUN_00407e00();
126 uVar13 = extraout_DL_07;
127 if (iVar7 != -1) {
128 _guard_check_icall();
129 FUN_004040e0(&stack0xffffcffc);
130 if (pFVar6[0x203]._base == (char *)0x1) {
131 FUN_00403dc0((LPCSTR)&pFVar6[0x103]._base);
132 }
133 FUN_00401730((FILE **)pFVar6);
134 uVar13 = extraout_DL_08;
135 }
136 }
137LAB_00402526:
138 FUN_004075a4(uVar5 ^ (uint)&stack0xffffcffc,uVar13,in_stack_ffffcffc);
139 return;
140}
141
142/* Function: FUN_00401030 */
143int __cdecl FUN_00401030(undefined4 param_1,uint *param_2)
144
145{
146 u_long uVar1;
147 int iVar2;
148 int iVar3;
149 uint *puStack52;
150 u_long uStack48;
151 int iStack40;
152 u_long uStack36;
153 undefined4 uStack20;
154 undefined4 uStack16;
155 undefined4 uStack12;
156
157 uVar1 = htonl(param_2[3]);
158 iVar2 = FUN_004094a8(uVar1);
159 if (iVar2 == 0) {
160 FUN_00401820("Error allocating decompression buffer\n");
161 return 0;
162 }
163 uStack20 = 0;
164 uStack16 = 0;
165 uStack12 = 0;
166 puStack52 = param_2;
167 uStack48 = htonl(param_2[2]);
168 iStack40 = iVar2;
169 uStack36 = htonl(param_2[3]);
170 iVar3 = FUN_00406460((int)&puStack52,"1.2.11",0x38);
171 if (-1 < iVar3) {
172 iVar3 = FUN_00404ba0(&puStack52,4);
173 if (-1 < iVar3) {
174 FUN_00406330((int)&puStack52);
175 return iVar2;
176 }
177 FUN_00401820("Error %d from inflate: %s\n");
178 return 0;
179 }
180 FUN_00401820("Error %d from inflateInit: %s\n");
181 return 0;
182}
183
184/* Function: FUN_00401120 */
185int __cdecl FUN_00401120(FILE **param_1)
186
187{
188 FILE **ppFVar1;
189 char cVar2;
190 int iVar3;
191 int local_4;
192
193 ppFVar1 = param_1;
194 local_4 = 0;
195 _fseek(*param_1,0,0);
196 _fread(¶m_1,1,2,*ppFVar1);
197 if (((char)((uint)param_1 & 0xffff) == 'M') && ((char)(((uint)param_1 & 0xffff) >> 8) == 'Z')) {
198 _fseek(*ppFVar1,0x3c,0);
199 _fread(&local_4,4,1,*ppFVar1);
200 _fseek(*ppFVar1,local_4 + 0x18,0);
201 _fread(¶m_1,2,1,*ppFVar1);
202 if ((char)((uint)param_1 & 0xffff) == '\v') {
203 cVar2 = (char)(((uint)param_1 & 0xffff) >> 8);
204 if (cVar2 == '\x01') {
205 iVar3 = 0x98;
206 }
207 else {
208 if (cVar2 != '\x02') {
209 return -1;
210 }
211 iVar3 = 0xa8;
212 }
213 _fseek(*ppFVar1,local_4 + iVar3,0);
214 _fread(&local_4,4,1,*ppFVar1);
215 if (local_4 == 0) {
216 local_4 = -1;
217 }
218 return local_4;
219 }
220 }
221 return -1;
222}
223
224/* Function: FUN_00401200 */
225void __cdecl FUN_00401200(FILE **param_1)
226
227{
228 if (*param_1 != (FILE *)0x0) {
229 _fclose(*param_1);
230 *param_1 = (FILE *)0x0;
231 }
232 return;
233}
234
235/* Function: FUN_00401220 */
236void * __cdecl FUN_00401220(FILE **param_1,uint *param_2)
237
238{
239 FILE *pFVar1;
240 u_long uVar2;
241 void *_DstBuf;
242 void *pvVar3;
243 int _Origin;
244 size_t sVar4;
245
246 if (*param_1 == (FILE *)0x0) {
247 pFVar1 = (FILE *)FUN_00402710((LPCSTR)(param_1 + 0x1a),"rb");
248 *param_1 = pFVar1;
249 if (pFVar1 == (FILE *)0x0) {
250 FUN_00401820("Cannot open archive file\n");
251 return (void *)0x0;
252 }
253 }
254 _Origin = 0;
255 uVar2 = htonl(param_2[1]);
256 _fseek(*param_1,(int)¶m_1[1]->_ptr + uVar2,_Origin);
257 uVar2 = htonl(param_2[2]);
258 _DstBuf = (void *)FUN_004094a8(uVar2);
259 if (_DstBuf == (void *)0x0) {
260 FUN_00401820("Could not allocate read buffer\n");
261 return (void *)0x0;
262 }
263 pFVar1 = *param_1;
264 sVar4 = 1;
265 uVar2 = htonl(param_2[2]);
266 sVar4 = _fread(_DstBuf,uVar2,sVar4,pFVar1);
267 if (sVar4 == 0) {
268 FUN_00401820("Could not read from file\n");
269 FID_conflict__free(_DstBuf);
270 return (void *)0x0;
271 }
272 pvVar3 = _DstBuf;
273 if (*(char *)(param_2 + 4) == '\x01') {
274 pvVar3 = (void *)FUN_00401030(_DstBuf,param_2);
275 FID_conflict__free(_DstBuf);
276 if (pvVar3 == (void *)0x0) {
277 FUN_00401820("Error decompressing %s\n");
278 return (void *)0x0;
279 }
280 }
281 if (*param_1 != (FILE *)0x0) {
282 _fclose(*param_1);
283 *param_1 = (FILE *)0x0;
284 }
285 return pvVar3;
286}
287
288/* Function: FUN_00401320 */
289undefined4 __cdecl FUN_00401320(FILE **param_1,uint *param_2)
290
291{
292 void *_Str;
293 int iVar1;
294 FILE *_File;
295 u_long _Size;
296 size_t sVar2;
297
298 _Str = FUN_00401220(param_1,param_2);
299 iVar1 = FUN_004038e0((int)param_1);
300 if (iVar1 == -1) {
301 return 0xffffffff;
302 }
303 _File = (FILE *)FUN_00403bd0(param_1 + 0x81a,(int)param_2 + 0x12);
304 _Size = htonl(param_2[3]);
305 if (_File == (FILE *)0x0) {
306 FUN_00401800("fopen","%s could not be extracted!\n");
307 return 0xffffffff;
308 }
309 sVar2 = _fwrite(_Str,_Size,1,_File);
310 if ((sVar2 != 1) && (_Size != 0)) {
311 FUN_00401800("fwrite","Failed to write all bytes for %s\n");
312 return 0xffffffff;
313 }
314 _fclose(_File);
315 FID_conflict__free(_Str);
316 return 0;
317}
318
319/* Function: FUN_004013d0 */
320void __cdecl FUN_004013d0(FILE **param_1,int param_2)
321
322{
323 FILE *pFVar1;
324 FILE *pFVar2;
325 FILE *pFVar3;
326 int iVar4;
327 size_t sVar5;
328 u_long uVar6;
329 undefined extraout_DL;
330 undefined extraout_DL_00;
331 undefined extraout_DL_01;
332 undefined uVar7;
333 undefined extraout_DL_02;
334 FILE **_Str2;
335 undefined in_stack_ffffff9c;
336 FILE *local_5c [22];
337 uint local_4;
338
339 local_4 = DAT_0042d008 ^ (uint)&stack0xffffff9c;
340 _Str2 = local_5c;
341 iVar4 = _fseek(*param_1,param_2 + -0x60,0);
342 uVar7 = extraout_DL;
343 if (iVar4 == 0) {
344 sVar5 = _fread(&stack0xffffff9c,0x60,1,*param_1);
345 uVar7 = extraout_DL_00;
346 if (sVar5 != 0) {
347 do {
348 iVar4 = _strncmp("MEI\f\v\n\v\x0e",(char *)_Str2,8);
349 if (iVar4 == 0) {
350 pFVar1 = _Str2[1];
351 pFVar2 = _Str2[2];
352 pFVar3 = _Str2[3];
353 param_1[4] = *_Str2;
354 param_1[5] = pFVar1;
355 param_1[6] = pFVar2;
356 param_1[7] = pFVar3;
357 pFVar1 = _Str2[5];
358 pFVar2 = _Str2[6];
359 pFVar3 = _Str2[7];
360 param_1[8] = _Str2[4];
361 param_1[9] = pFVar1;
362 param_1[10] = pFVar2;
363 param_1[0xb] = pFVar3;
364 pFVar1 = _Str2[9];
365 pFVar2 = _Str2[10];
366 pFVar3 = _Str2[0xb];
367 param_1[0xc] = _Str2[8];
368 param_1[0xd] = pFVar1;
369 param_1[0xe] = pFVar2;
370 param_1[0xf] = pFVar3;
371 pFVar1 = _Str2[0xd];
372 pFVar2 = _Str2[0xe];
373 pFVar3 = _Str2[0xf];
374 param_1[0x10] = _Str2[0xc];
375 param_1[0x11] = pFVar1;
376 param_1[0x12] = pFVar2;
377 param_1[0x13] = pFVar3;
378 pFVar1 = _Str2[0x11];
379 pFVar2 = _Str2[0x12];
380 pFVar3 = _Str2[0x13];
381 param_1[0x14] = _Str2[0x10];
382 param_1[0x15] = pFVar1;
383 param_1[0x16] = pFVar2;
384 param_1[0x17] = pFVar3;
385 *(undefined8 *)(param_1 + 0x18) = *(undefined8 *)(_Str2 + 0x14);
386 uVar6 = htonl((u_long)param_1[6]);
387 param_1[1] = (FILE *)((int)_Str2 +
388 (((param_2 + -0x60) - (int)&stack0xffffff9c) - uVar6) + 0x58);
389 FUN_004075a4(local_4 ^ (uint)&stack0xffffff9c,extraout_DL_02,in_stack_ffffff9c);
390 return;
391 }
392 _Str2 = (FILE **)((int)_Str2 + -1);
393 uVar7 = extraout_DL_01;
394 } while (&stack0xffffff9c <= _Str2);
395 }
396 }
397 FUN_004075a4(local_4 ^ (uint)&stack0xffffff9c,uVar7,in_stack_ffffff9c);
398 return;
399}
400
401/* Function: FUN_004014b0 */
402char * __cdecl FUN_004014b0(int param_1,char *param_2)
403
404{
405 char cVar1;
406 int iVar2;
407 u_long uVar3;
408 u_long *puVar4;
409 char *pcVar5;
410
411 puVar4 = *(u_long **)(param_1 + 8);
412 pcVar5 = param_2;
413 do {
414 cVar1 = *pcVar5;
415 pcVar5 = pcVar5 + 1;
416 } while (cVar1 != '\0');
417 pcVar5 = pcVar5 + -(int)(param_2 + 1);
418 if (puVar4 < *(u_long **)(param_1 + 0xc)) {
419 do {
420 if ((*(char *)((int)puVar4 + 0x11) == 'o') &&
421 (iVar2 = _strncmp((char *)((int)puVar4 + 0x12),param_2,(size_t)pcVar5), iVar2 == 0)) {
422 if (pcVar5[(int)puVar4 + 0x12] == '\0') {
423 return pcVar5 + (int)puVar4 + 0x12;
424 }
425 return pcVar5 + (int)puVar4 + 0x13;
426 }
427 uVar3 = htonl(*puVar4);
428 puVar4 = (u_long *)((int)puVar4 + uVar3);
429 if (puVar4 < *(u_long **)(param_1 + 8)) {
430 FUN_00401820("Cannot read Table of Contents.\n");
431 puVar4 = *(u_long **)(param_1 + 0xc);
432 }
433 } while (puVar4 < *(u_long **)(param_1 + 0xc));
434 }
435 return (char *)0x0;
436}
437
438/* Function: FUN_00401530 */
439uint __cdecl FUN_00401530(int param_1,u_long *param_2)
440
441{
442 u_long uVar1;
443 uint uVar2;
444
445 uVar1 = htonl(*param_2);
446 uVar2 = uVar1 + (int)param_2;
447 if (uVar2 < *(uint *)(param_1 + 8)) {
448 FUN_00401820("Cannot read Table of Contents.\n");
449 uVar2 = *(uint *)(param_1 + 0xc);
450 }
451 return uVar2;
452}
453
454/* Function: FUN_00401560 */
455undefined4 __cdecl FUN_00401560(FILE **param_1)
456
457{
458 FILE *pFVar1;
459 int iVar2;
460 u_long uVar3;
461 size_t sVar4;
462
463 if (*param_1 == (FILE *)0x0) {
464 pFVar1 = (FILE *)FUN_00402710((LPCSTR)(param_1 + 0x1a),"rb");
465 *param_1 = pFVar1;
466 if (pFVar1 == (FILE *)0x0) {
467 return 0xffffffff;
468 }
469 }
470 iVar2 = FUN_00401120(param_1);
471 if (iVar2 < 1) {
472 _fseek(*param_1,0,2);
473 iVar2 = _ftell(*param_1);
474 }
475 iVar2 = FUN_004013d0(param_1,iVar2);
476 if (iVar2 != -1) {
477 param_1[0x101b] = (FILE *)0x0;
478 DAT_0042d954 = htonl((u_long)param_1[9]);
479 iVar2 = 0;
480 uVar3 = htonl((u_long)param_1[7]);
481 _fseek(*param_1,(int)¶m_1[1]->_ptr + uVar3,iVar2);
482 uVar3 = htonl((u_long)param_1[8]);
483 pFVar1 = (FILE *)FUN_004094a8(uVar3);
484 param_1[2] = pFVar1;
485 if (pFVar1 != (FILE *)0x0) {
486 pFVar1 = *param_1;
487 sVar4 = 1;
488 uVar3 = htonl((u_long)param_1[8]);
489 sVar4 = _fread(param_1[2],uVar3,sVar4,pFVar1);
490 if (sVar4 == 0) {
491 FUN_00401800("fread","Could not read from file.");
492 return 0xffffffff;
493 }
494 uVar3 = htonl((u_long)param_1[8]);
495 param_1[3] = (FILE *)((int)¶m_1[2]->_ptr + uVar3);
496 iVar2 = _ferror(*param_1);
497 if (iVar2 == 0) {
498 FUN_00401200(param_1);
499 return 0;
500 }
501 FUN_00401820("Error on file\n.");
502 return 0xffffffff;
503 }
504 FUN_00401800("malloc","Could not allocate buffer for TOC.");
505 }
506 return 0xffffffff;
507}
508
509/* Function: FUN_00401690 */
510undefined4 __cdecl FUN_00401690(FILE **param_1,char *param_2)
511
512{
513 FILE **ppFVar1;
514 char cVar2;
515 int iVar3;
516 char *pcVar4;
517 FILE **ppFVar5;
518
519 pcVar4 = param_2;
520 do {
521 cVar2 = *pcVar4;
522 pcVar4 = pcVar4 + 1;
523 } while (cVar2 != '\0');
524 if ((char *)0xfff < pcVar4 + -(int)(param_2 + 1)) {
525 return 0;
526 }
527 pcVar4 = param_2;
528 do {
529 cVar2 = *pcVar4;
530 pcVar4 = pcVar4 + 1;
531 pcVar4[(int)param_1 + (0x67 - (int)param_2)] = cVar2;
532 } while (cVar2 != '\0');
533 ppFVar1 = param_1 + 0x41a;
534 FUN_00402580((undefined2 *)ppFVar1,param_2);
535 param_1[0x101a] = (FILE *)0x0;
536 ppFVar5 = ppFVar1;
537 do {
538 cVar2 = *(char *)ppFVar5;
539 ppFVar5 = (FILE **)((int)ppFVar5 + 1);
540 *(char *)((int)param_1 + (0x3067 - (int)ppFVar1) + (int)ppFVar5) = cVar2;
541 } while (cVar2 != '\0');
542 iVar3 = FUN_00401560(param_1);
543 if (iVar3 != 0) {
544 if (*param_1 != (FILE *)0x0) {
545 _fclose(*param_1);
546 *param_1 = (FILE *)0x0;
547 }
548 return 0;
549 }
550 return 1;
551}
552
553/* Function: FUN_00401730 */
554void __cdecl FUN_00401730(FILE **param_1)
555
556{
557 if (param_1 != (FILE **)0x0) {
558 if (param_1[2] != (FILE *)0x0) {
559 FID_conflict__free(param_1[2]);
560 }
561 if (*param_1 != (FILE *)0x0) {
562 _fclose(*param_1);
563 *param_1 = (FILE *)0x0;
564 }
565 FID_conflict__free(param_1);
566 }
567 return;
568}
569
570/* Function: FUN_00401770 */
571int FUN_00401770(void)
572
573{
574 int iVar1;
575
576 iVar1 = FUN_00409498(1,0x4078);
577 if (iVar1 == 0) {
578 FUN_00401800("calloc","Cannot allocate memory for ARCHIVE_STATUS\n");
579 }
580 return iVar1;
581}
582
583/* Function: FUN_004017a0 */
584undefined * FUN_004017a0(void)
585
586{
587 return &DAT_00437648;
588}
589
590/* Function: FUN_004017b0 */
591void __cdecl FUN_004017b0(FILE *param_1,int param_2)
592
593{
594 undefined4 *puVar1;
595 undefined4 uVar2;
596 undefined *puVar3;
597
598 puVar3 = &stack0x0000000c;
599 uVar2 = 0;
600 puVar1 = (undefined4 *)FUN_004017a0();
601 FID_conflict____stdio_common_vfprintf(*puVar1,puVar1[1],param_1,param_2,uVar2,puVar3);
602 return;
603}
604
605/* Function: FUN_004017e0 */
606void __cdecl FUN_004017e0(char *param_1)
607
608{
609 FUN_00401880(param_1,&stack0x00000008);
610 return;
611}
612
613/* Function: FUN_00401800 */
614void __cdecl FUN_00401800(char *param_1,char *param_2)
615
616{
617 FUN_00401880(param_2,&stack0x0000000c);
618 _perror(param_1);
619 return;
620}
621
622/* Function: FUN_00401820 */
623void __cdecl FUN_00401820(char *param_1)
624
625{
626 FILE *pFVar1;
627 char *pcVar2;
628
629 GetCurrentProcessId();
630 pcVar2 = "[%d] ";
631 pFVar1 = (FILE *)___acrt_iob_func(2);
632 FUN_004017b0(pFVar1,(int)pcVar2);
633 FUN_00401880(param_1,&stack0x00000008);
634 return;
635}
636
637/* Function: FUN_00401850 */
638void __cdecl FUN_00401850(undefined4 param_1,char *param_2)
639
640{
641 DWORD DVar1;
642
643 FUN_00401880(param_2,&stack0x0000000c);
644 DVar1 = GetLastError();
645 FUN_00404540(DVar1);
646 FUN_004017e0("%s: %s");
647 return;
648}
649
650/* Function: FUN_00401880 */
651/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
652
653void __cdecl FUN_00401880(char *param_1,char *param_2)
654
655{
656 uint *puVar1;
657 FILE *pFVar2;
658 LPCSTR pCVar3;
659 undefined extraout_DL;
660 uint uVar4;
661 char *pcVar5;
662 uint uVar6;
663 __crt_locale_pointers *p_Var7;
664 undefined *puVar8;
665 char in_stack_ffffeffc;
666 WCHAR local_804 [1024];
667 uint local_4;
668
669 pcVar5 = &stack0xffffeffc;
670 local_4 = DAT_0042d008 ^ (uint)&stack0xffffeffc;
671 p_Var7 = (__crt_locale_pointers *)0x0;
672 uVar6 = 0x800;
673 puVar1 = (uint *)FUN_004017a0();
674 uVar4 = puVar1[1];
675 pCVar3 = (LPCSTR)(*puVar1 | 1);
676 ___stdio_common_vsprintf(pCVar3,uVar4,pcVar5,uVar6,param_1,p_Var7,param_2);
677 FUN_004047c0(local_804,&stack0xffffeffc,(char *)0x800,pCVar3,uVar4);
678 puVar8 = &DAT_004213d0;
679 pFVar2 = (FILE *)___acrt_iob_func(2);
680 FUN_004017b0(pFVar2,(int)puVar8);
681 FUN_004075a4(local_4 ^ (uint)&stack0xffffeffc,extraout_DL,in_stack_ffffeffc);
682 return;
683}
684
685/* Function: FUN_00401920 */
686/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
687
688void __cdecl FUN_00401920(int *param_1,undefined4 param_2)
689
690{
691 int iVar1;
692 int iVar2;
693 FILE *pFVar3;
694 undefined extraout_DL;
695 undefined extraout_DL_00;
696 undefined extraout_DL_01;
697 undefined extraout_DL_02;
698 undefined extraout_DL_03;
699 undefined extraout_DL_04;
700 undefined extraout_DL_05;
701 undefined uVar4;
702 byte in_stack_ffffaffc;
703 byte local_4004 [4096];
704 char local_3004 [4096];
705 CHAR local_2004 [4096];
706 undefined2 local_1004 [2048];
707 uint local_4;
708
709 local_4 = DAT_0042d008 ^ (uint)&stack0xffffaffc;
710 iVar2 = *param_1;
711 iVar1 = FUN_00402230(local_3004,&stack0xffffaffc,param_2);
712 if (iVar1 == -1) {
713 FUN_004075a4(local_4 ^ (uint)&stack0xffffaffc,extraout_DL,in_stack_ffffaffc);
714 return;
715 }
716 FUN_00402580(local_1004,local_3004);
717 iVar1 = FUN_00401d40(local_2004,"%s%s%s%s%s");
718 if (iVar1 == 0) {
719 iVar1 = FUN_004038e0(iVar2);
720 if (iVar1 == -1) goto LAB_00401a4e;
721 iVar2 = FUN_004037b0(local_2004,iVar2 + 0x2068,&stack0xffffaffc);
722 uVar4 = extraout_DL_00;
723 }
724 else {
725 iVar1 = FUN_00401d40(local_2004,"%s%s%s%s%s%s%s");
726 if (iVar1 != 0) {
727 iVar2 = FUN_00401d40((LPCSTR)local_4004,"%s%s%s.pkg");
728 if (iVar2 != 0) {
729 iVar2 = FUN_00401d40((LPCSTR)local_4004,"%s%s%s.exe");
730 if (iVar2 != 0) {
731 iVar2 = FUN_00401d40((LPCSTR)local_4004,"%s%s%s");
732 if (iVar2 != 0) goto LAB_00401b07;
733 }
734 }
735 pFVar3 = FUN_00401ba0(param_1,local_4004);
736 if (pFVar3 == (FILE *)0x0) {
737LAB_00401b07:
738 FUN_00401820("Archive not found: %s\n");
739 FUN_004075a4(local_4 ^ (uint)&stack0xffffaffc,extraout_DL_03,in_stack_ffffaffc);
740 return;
741 }
742 iVar2 = FUN_00401e00((FILE **)pFVar3,&stack0xffffaffc);
743 uVar4 = extraout_DL_04;
744 if (iVar2 == -1) {
745 FUN_00401820("Error extracting %s\n");
746 FUN_00401730((FILE **)pFVar3);
747 FUN_004075a4(local_4 ^ (uint)&stack0xffffaffc,extraout_DL_05,in_stack_ffffaffc);
748 return;
749 }
750 goto LAB_00401b7d;
751 }
752 iVar2 = FUN_00401dc0(iVar2,local_2004,&stack0xffffaffc);
753 uVar4 = extraout_DL_01;
754 }
755 if (iVar2 != -1) {
756LAB_00401b7d:
757 FUN_004075a4(local_4 ^ (uint)&stack0xffffaffc,uVar4,in_stack_ffffaffc);
758 return;
759 }
760LAB_00401a4e:
761 FUN_00401820("Error copying %s\n");
762 FUN_004075a4(local_4 ^ (uint)&stack0xffffaffc,extraout_DL_02,in_stack_ffffaffc);
763 return;
764}
765
766/* Function: FUN_00401ba0 */
767FILE * __cdecl FUN_00401ba0(int *param_1,byte *param_2)
768
769{
770 byte bVar1;
771 int *piVar2;
772 int iVar3;
773 byte *pbVar4;
774 uint uVar5;
775 FILE *pFVar6;
776 byte *pbVar7;
777 int iVar8;
778 bool bVar9;
779
780 iVar3 = FUN_004038e0(*param_1);
781 if (iVar3 == -1) {
782 return (FILE *)0x0;
783 }
784 iVar3 = param_1[1];
785 piVar2 = param_1 + 1;
786 iVar8 = 1;
787 do {
788 if (iVar3 == 0) {
789 pFVar6 = (FILE *)FUN_00401770();
790 if (pFVar6 != (FILE *)0x0) {
791 iVar3 = _snprintf((char *)&pFVar6[3]._base,0x1000,"%s",param_2);
792 if (((iVar3 < 0x1000) &&
793 (iVar3 = _snprintf((char *)&pFVar6[0x83]._base,0x1000,"%s",*param_1 + 0x1068),
794 iVar3 < 0x1000)) &&
795 (iVar3 = _snprintf((char *)&pFVar6[0x103]._base,0x1000,"%s",*param_1 + 0x2068),
796 iVar3 < 0x1000)) {
797 pFVar6[0x203]._base = *(char **)(*param_1 + 0x4068);
798 iVar3 = FUN_00401560((FILE **)pFVar6);
799 if (iVar3 == 0) {
800 param_1[iVar8] = (int)pFVar6;
801 return pFVar6;
802 }
803 FUN_00401800("malloc","Error opening archive %s\n");
804 FUN_00401730((FILE **)pFVar6);
805 return (FILE *)0x0;
806 }
807 FUN_00401820("Archive path exceeds PATH_MAX\n");
808 FUN_00401730((FILE **)pFVar6);
809 }
810 return (FILE *)0x0;
811 }
812 pbVar4 = (byte *)(*piVar2 + 0x68);
813 pbVar7 = param_2;
814 do {
815 bVar1 = *pbVar4;
816 bVar9 = bVar1 < *pbVar7;
817 if (bVar1 != *pbVar7) {
818LAB_00401bf7:
819 uVar5 = -(uint)bVar9 | 1;
820 goto LAB_00401bfc;
821 }
822 if (bVar1 == 0) break;
823 bVar1 = pbVar4[1];
824 bVar9 = bVar1 < pbVar7[1];
825 if (bVar1 != pbVar7[1]) goto LAB_00401bf7;
826 pbVar4 = pbVar4 + 2;
827 pbVar7 = pbVar7 + 2;
828 } while (bVar1 != 0);
829 uVar5 = 0;
830LAB_00401bfc:
831 if (uVar5 == 0) {
832 return (FILE *)param_1[iVar8];
833 }
834 iVar8 = iVar8 + 1;
835 iVar3 = param_1[iVar8];
836 piVar2 = param_1 + iVar8;
837 } while( true );
838}
839
840/* Function: _snprintf */
841/* Library Function - Single Match
842 _snprintf
843
844 Library: Visual Studio 2019 Release */
845
846int __cdecl _snprintf(char *_Dest,size_t _Count,char *_Format,...)
847
848{
849 uint *puVar1;
850 int iVar2;
851 __crt_locale_pointers *p_Var3;
852 char *pcVar4;
853
854 pcVar4 = &stack0x00000010;
855 p_Var3 = (__crt_locale_pointers *)0x0;
856 puVar1 = (uint *)FUN_004017a0();
857 iVar2 = ___stdio_common_vsprintf(*puVar1 | 1,puVar1[1],_Dest,_Count,_Format,p_Var3,pcVar4);
858 if (iVar2 < 0) {
859 iVar2 = -1;
860 }
861 return iVar2;
862}
863
864/* Function: FUN_00401d40 */
865void __cdecl FUN_00401d40(LPCSTR param_1,char *param_2)
866
867{
868 uint *puVar1;
869 int iVar2;
870 undefined extraout_DL;
871 undefined extraout_DL_00;
872 LPCSTR pCVar3;
873 uint uVar4;
874 __crt_locale_pointers *p_Var5;
875 char *pcVar6;
876 _stat64i32 in_stack_ffffffcc;
877 uint local_4;
878
879 local_4 = DAT_0042d008 ^ (uint)&stack0xffffffcc;
880 pcVar6 = &stack0x0000000c;
881 p_Var5 = (__crt_locale_pointers *)0x0;
882 uVar4 = 0x1000;
883 pCVar3 = param_1;
884 puVar1 = (uint *)FUN_004017a0();
885 iVar2 = ___stdio_common_vsprintf(*puVar1 | 1,puVar1[1],pCVar3,uVar4,param_2,p_Var5,pcVar6);
886 if (iVar2 < 0) {
887 iVar2 = -1;
888 }
889 if (0xfff < iVar2) {
890 FUN_004075a4(local_4 ^ (uint)&stack0xffffffcc,extraout_DL,in_stack_ffffffcc);
891 return;
892 }
893 FID_conflict___stat64i32(param_1,(_stat64i32 *)&stack0xffffffcc);
894 FUN_004075a4(local_4 ^ (uint)&stack0xffffffcc,extraout_DL_00,in_stack_ffffffcc);
895 return;
896}
897
898/* Function: FUN_00401dc0 */
899int __cdecl FUN_00401dc0(int param_1,LPCSTR param_2,undefined4 param_3)
900
901{
902 int iVar1;
903
904 iVar1 = FUN_004038e0(param_1);
905 if (iVar1 == -1) {
906 return -1;
907 }
908 iVar1 = FUN_004037b0(param_2,param_1 + 0x2068,param_3);
909 return (iVar1 != -1) - 1;
910}
911
912/* Function: FUN_00401e00 */
913undefined4 __cdecl FUN_00401e00(FILE **param_1,byte *param_2)
914
915{
916 byte bVar1;
917 byte *pbVar2;
918 uint uVar3;
919 int iVar4;
920 FILE *pFVar5;
921 byte *pbVar6;
922 bool bVar7;
923
924 pFVar5 = param_1[2];
925 if (pFVar5 < param_1[3]) {
926 do {
927 pbVar6 = (byte *)((int)&pFVar5->_file + 2);
928 pbVar2 = param_2;
929 do {
930 bVar1 = *pbVar6;
931 bVar7 = bVar1 < *pbVar2;
932 if (bVar1 != *pbVar2) {
933LAB_00401e38:
934 uVar3 = -(uint)bVar7 | 1;
935 goto LAB_00401e3d;
936 }
937 if (bVar1 == 0) break;
938 bVar1 = pbVar6[1];
939 bVar7 = bVar1 < pbVar2[1];
940 if (bVar1 != pbVar2[1]) goto LAB_00401e38;
941 pbVar6 = pbVar6 + 2;
942 pbVar2 = pbVar2 + 2;
943 } while (bVar1 != 0);
944 uVar3 = 0;
945LAB_00401e3d:
946 if ((uVar3 == 0) && (iVar4 = FUN_00401320(param_1,(uint *)pFVar5), iVar4 != 0)) {
947 return 0xffffffff;
948 }
949 pFVar5 = (FILE *)FUN_00401530((int)param_1,(u_long *)pFVar5);
950 } while (pFVar5 < param_1[3]);
951 }
952 return 0;
953}
954
955/* Function: FUN_00401e70 */
956undefined4 __cdecl FUN_00401e70(FILE **param_1)
957
958{
959 int iVar1;
960 undefined4 uVar2;
961
962 iVar1 = FUN_00403270((int)param_1);
963 if (iVar1 == 0) {
964 param_1[0x101b] = (FILE *)0x1;
965 iVar1 = FUN_00403670((int)param_1);
966 if (iVar1 == 0) {
967 iVar1 = FUN_00403060(param_1);
968 if (iVar1 == 0) {
969 iVar1 = FUN_004031a0((int)param_1);
970 if (iVar1 == 0) {
971 uVar2 = FUN_00402070(param_1);
972 return uVar2;
973 }
974 }
975 }
976 }
977 return 0xffffffff;
978}
979
980/* Function: FUN_00401ed0 */
981void __cdecl FUN_00401ed0(FILE *param_1)
982
983{
984 char cVar1;
985 int iVar2;
986 uint *puVar3;
987 undefined extraout_DL;
988 undefined extraout_DL_00;
989 undefined uVar4;
990 undefined extraout_DL_01;
991 undefined extraout_DL_02;
992 undefined extraout_DL_03;
993 FILE *pFVar5;
994 FILE *local_50;
995 FILE *apFStack76 [18];
996 uint local_4;
997
998 local_4 = DAT_0042d008 ^ (uint)&stack0xffffffac;
999 puVar3 = (uint *)param_1->_base;
1000 _memset(&stack0xffffffac,0,0x50);
1001 uVar4 = extraout_DL;
1002 pFVar5 = param_1;
1003 if (puVar3 < (uint *)param_1->_flag) {
1004 do {
1005 cVar1 = *(char *)((int)puVar3 + 0x11);
1006 if (((cVar1 == 'b') || (cVar1 == 'x')) || (cVar1 == 'Z')) {
1007 iVar2 = FUN_00401320((FILE **)param_1,puVar3);
1008 uVar4 = extraout_DL_02;
1009 if (iVar2 != 0) break;
1010 }
1011 else {
1012 if ((cVar1 == 'd') &&
1013 (iVar2 = FUN_00401920((int *)&stack0xffffffac,(int)puVar3 + 0x12), uVar4 = extraout_DL_00
1014 , iVar2 == -1)) break;
1015 }
1016 puVar3 = (uint *)FUN_00401530((int)param_1,puVar3);
1017 uVar4 = extraout_DL_03;
1018 } while (puVar3 < (uint *)param_1->_flag);
1019 }
1020 iVar2 = 1;
1021 while (local_50 != (FILE *)0x0) {
1022 FUN_00401730((FILE **)local_50);
1023 local_50 = apFStack76[iVar2 + -1];
1024 iVar2 = iVar2 + 1;
1025 uVar4 = extraout_DL_01;
1026 }
1027 FUN_004075a4(local_4 ^ (uint)&stack0xffffffac,uVar4,(char)pFVar5);
1028 return;
1029}
1030
1031/* Function: thunk_FUN_00403030 */
1032/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
1033
1034void __cdecl thunk_FUN_00403030(int param_1)
1035
1036{
1037 if (*(int *)(param_1 + 0x406c) == 1) {
1038 (*_DAT_0042d9a0)(
1039 "import sys; sys.stdout.flush(); (sys.__stdout__.flush if sys.__stdout__ is not sys.stdout else (lambda: None))()"
1040 );
1041 (*_DAT_0042d9a0)(
1042 "import sys; sys.stderr.flush(); (sys.__stderr__.flush if sys.__stderr__ is not sys.stderr else (lambda: None))()"
1043 );
1044 /* WARNING: Could not recover jumptable at 0x00403056. Too many branches */
1045 /* WARNING: Treating indirect jump as call */
1046 (*_DAT_0042d97c)();
1047 return;
1048 }
1049 return;
1050}
1051
1052/* Function: FUN_00401fa0 */
1053/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
1054
1055void __cdecl FUN_00401fa0(int param_1)
1056
1057{
1058 char *pcVar1;
1059 undefined extraout_DL;
1060 undefined extraout_DL_00;
1061 undefined uVar2;
1062 char in_stack_ffffeffc;
1063 uint local_4;
1064
1065 local_4 = DAT_0042d008 ^ (uint)&stack0xffffeffc;
1066 pcVar1 = FUN_004014b0(param_1,"pyi-windows-manifest-filename");
1067 uVar2 = extraout_DL;
1068 if (pcVar1 != (char *)0x0) {
1069 pcVar1 = FUN_004027b0(&stack0xffffeffc,param_1 + 0x3068,pcVar1);
1070 if (pcVar1 == (char *)0x0) {
1071 FUN_00401820("Path of manifest-file (%s) length exceeds buffer[%d] space\n");
1072 }
1073 FUN_00404420(&stack0xffffeffc);
1074 uVar2 = extraout_DL_00;
1075 }
1076 FUN_004075a4(local_4 ^ (uint)&stack0xffffeffc,uVar2,in_stack_ffffeffc);
1077 return;
1078}
1079
1080/* Function: FUN_00402030 */
1081undefined4 __cdecl FUN_00402030(int param_1)
1082
1083{
1084 char cVar1;
1085 u_long *puVar2;
1086
1087 puVar2 = *(u_long **)(param_1 + 8);
1088 if (puVar2 < *(u_long **)(param_1 + 0xc)) {
1089 do {
1090 cVar1 = *(char *)((int)puVar2 + 0x11);
1091 if ((((cVar1 == 'b') || (cVar1 == 'x')) || (cVar1 == 'Z')) || (cVar1 == 'd')) {
1092 return 1;
1093 }
1094 puVar2 = (u_long *)FUN_00401530(param_1,puVar2);
1095 } while (puVar2 < *(u_long **)(param_1 + 0xc));
1096 }
1097 return 0;
1098}
1099
1100/* Function: FUN_00402070 */
1101/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
1102/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
1103
1104void __cdecl FUN_00402070(FILE **param_1)
1105
1106{
1107 int iVar1;
1108 void *_Memory;
1109 int iVar2;
1110 undefined4 uVar3;
1111 u_long uVar4;
1112 FILE *pFVar5;
1113 undefined extraout_DL;
1114 undefined extraout_DL_00;
1115 undefined extraout_DL_01;
1116 undefined extraout_DL_02;
1117 undefined uVar6;
1118 undefined extraout_DL_03;
1119 undefined extraout_DL_04;
1120 undefined extraout_DL_05;
1121 undefined uVar7;
1122 int iStack4104;
1123 char acStack4100 [4096];
1124 uint local_4;
1125
1126 local_4 = DAT_0042d008 ^ (uint)&stack0xffffeff4;
1127 pFVar5 = param_1[2];
1128 iVar1 = (*_DAT_0042d9ac)("__main__");
1129 if (iVar1 == 0) {
1130 FUN_00401820("Could not get __main__ module.");
1131 FUN_004075a4(local_4 ^ (uint)&stack0xffffeff4,extraout_DL,(char)iVar1);
1132 return;
1133 }
1134 iStack4104 = (*_DAT_0042d9cc)(iVar1);
1135 if (iStack4104 == 0) {
1136 FUN_00401820("Could not get __main__ module\'s dict.");
1137 FUN_004075a4(local_4 ^ (uint)&stack0xffffeff4,extraout_DL_01,(char)iVar1);
1138 return;
1139 }
1140 uVar6 = extraout_DL_00;
1141 if (pFVar5 < param_1[3]) {
1142 do {
1143 if (*(char *)((int)&pFVar5->_file + 1) == 's') {
1144 _Memory = FUN_00401220(param_1,(uint *)pFVar5);
1145 iVar2 = _snprintf(acStack4100,0x1000,"%s.py",(int)&pFVar5->_file + 2);
1146 if (0xfff < iVar2) {
1147 FUN_00401820("Name exceeds PATH_MAX\n");
1148 uVar7 = (undefined)iVar1;
1149 uVar6 = extraout_DL_05;
1150 goto LAB_004021c0;
1151 }
1152 uVar3 = (*_DAT_0042d9c0)(acStack4100);
1153 (*_DAT_0042d9b0)(iVar1,"__file__",uVar3);
1154 (*_DAT_0042d984)(uVar3);
1155 uVar4 = htonl(pFVar5->_flag);
1156 iVar2 = (*_DAT_0042da04)(_Memory,uVar4);
1157 if (iVar2 == 0) {
1158 FUN_00401820("Failed to unmarshal code object for %s\n");
1159 uVar7 = (undefined)iVar1;
1160 (*_DAT_0042d9dc)();
1161 uVar6 = extraout_DL_04;
1162 goto LAB_004021c0;
1163 }
1164 iVar2 = (*_DAT_0042da00)(iVar2,iStack4104,iStack4104);
1165 if (iVar2 == 0) {
1166 (*_DAT_0042d9dc)();
1167 uVar7 = (undefined)iVar1;
1168 FUN_00401820("Failed to execute script %s\n");
1169 uVar6 = extraout_DL_03;
1170 goto LAB_004021c0;
1171 }
1172 FID_conflict__free(_Memory);
1173 }
1174 pFVar5 = (FILE *)FUN_00401530((int)param_1,(u_long *)pFVar5);
1175 uVar6 = extraout_DL_02;
1176 } while (pFVar5 < param_1[3]);
1177 }
1178 uVar7 = (undefined)iVar1;
1179LAB_004021c0:
1180 FUN_004075a4(local_4 ^ (uint)&stack0xffffeff4,uVar6,uVar7);
1181 return;
1182}
1183
1184/* Function: FUN_00402230 */
1185undefined4 __cdecl FUN_00402230(char *param_1,char *param_2,undefined4 param_3)
1186
1187{
1188 char cVar1;
1189 int iVar2;
1190 char *pcVar3;
1191 char *pcVar4;
1192
1193 iVar2 = _snprintf(param_1,0x1000,"%s",param_3);
1194 if (iVar2 < 0x1000) {
1195 pcVar3 = _strchr(param_1,0x3a);
1196 if (pcVar3 != (char *)0x0) {
1197 *pcVar3 = '\0';
1198 pcVar4 = pcVar3 + 1;
1199 do {
1200 cVar1 = *pcVar4;
1201 pcVar4 = pcVar4 + 1;
1202 pcVar4[(int)(param_2 + (-1 - (int)(pcVar3 + 1)))] = cVar1;
1203 } while (cVar1 != '\0');
1204 if ((*param_1 != '\0') && (*param_2 != '\0')) {
1205 return 0;
1206 }
1207 return 0xffffffff;
1208 }
1209 }
1210 return 0xffffffff;
1211}
1212
1213/* Function: FUN_00402540 */
1214undefined4 __cdecl FUN_00402540(char *param_1,char *param_2)
1215
1216{
1217 char cVar1;
1218 char *pcVar2;
1219
1220 pcVar2 = param_2;
1221 do {
1222 cVar1 = *pcVar2;
1223 pcVar2 = pcVar2 + 1;
1224 pcVar2[(int)(param_1 + (-1 - (int)param_2))] = cVar1;
1225 } while (cVar1 != '\0');
1226 do {
1227 pcVar2 = param_1;
1228 param_1 = pcVar2 + 1;
1229 } while (*pcVar2 != '\0');
1230 *(undefined4 *)(pcVar2 + -3) = 0x676b70;
1231 return 1;
1232}
1233
1234/* Function: FUN_00402580 */
1235undefined4 __cdecl FUN_00402580(undefined2 *param_1,undefined4 param_2)
1236
1237{
1238 char cVar1;
1239 int iVar2;
1240 char *pcVar3;
1241 undefined2 *puVar4;
1242
1243 iVar2 = _snprintf((char *)param_1,0x1000,"%s",param_2);
1244 if (0xfff < iVar2) {
1245 return 0;
1246 }
1247 puVar4 = param_1;
1248 do {
1249 cVar1 = *(char *)puVar4;
1250 puVar4 = (undefined2 *)((int)puVar4 + 1);
1251 } while (cVar1 != '\0');
1252 puVar4 = (undefined2 *)((int)puVar4 - ((int)param_1 + 1));
1253 if (*(char *)((int)puVar4 + -1 + (int)param_1) == '\\') {
1254 *(undefined *)((int)puVar4 + -1 + (int)param_1) = 0;
1255 }
1256 pcVar3 = _strrchr((char *)param_1,0x5c);
1257 if (pcVar3 != (char *)0x0) {
1258 *pcVar3 = '\0';
1259 return 1;
1260 }
1261 *param_1 = 0x2e;
1262 return 1;
1263}
1264
1265/* Function: FUN_004025f0 */
1266/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
1267
1268void __cdecl FUN_004025f0(LPSTR param_1)
1269
1270{
1271 DWORD DVar1;
1272 LPSTR pCVar2;
1273 undefined extraout_DL;
1274 undefined extraout_DL_00;
1275 undefined extraout_DL_01;
1276 LPCWSTR unaff_ESI;
1277 undefined in_stack_ffffdffc;
1278 uint local_4;
1279
1280 local_4 = DAT_0042d008 ^ (uint)&stack0xffffdffc;
1281 DVar1 = GetModuleFileNameW((HMODULE)0x0,(LPWSTR)&stack0xffffdffc,0x1000);
1282 if (DVar1 == 0) {
1283 FUN_00401850("GetModuleFileNameW","Failed to get executable path.");
1284 FUN_004075a4(local_4 ^ (uint)&stack0xffffdffc,extraout_DL,in_stack_ffffdffc);
1285 return;
1286 }
1287 pCVar2 = FUN_00404930(param_1,(LPCWSTR)&stack0xffffdffc,0x1000,unaff_ESI);
1288 if (pCVar2 == (LPSTR)0x0) {
1289 FUN_00401820("Failed to convert executable path to UTF-8.");
1290 FUN_004075a4(local_4 ^ (uint)&stack0xffffdffc,extraout_DL_01,in_stack_ffffdffc);
1291 return;
1292 }
1293 FUN_004075a4(local_4 ^ (uint)&stack0xffffdffc,extraout_DL_00,in_stack_ffffdffc);
1294 return;
1295}
1296
1297/* Function: FUN_004026b0 */
1298/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
1299
1300void __cdecl FUN_004026b0(LPCSTR param_1)
1301
1302{
1303 undefined extraout_DL;
1304 _stat64i32 _Var1;
1305 LPCSTR in_stack_ffffdfc8;
1306 WCHAR local_2008 [4098];
1307 uint local_4;
1308
1309 local_4 = DAT_0042d008 ^ (uint)&stack0xffffdfc8;
1310 FUN_00404890(local_2008,param_1,0x1000,in_stack_ffffdfc8);
1311 _Var1 = SUB41(in_stack_ffffdfc8,0);
1312 FUN_0040d7a9((wchar_t *)local_2008,(_stat64i32 *)&stack0xffffdfc8);
1313 FUN_004075a4(local_4 ^ (uint)&stack0xffffdfc8,extraout_DL,_Var1);
1314 return;
1315}
1316
1317/* Function: FUN_00402710 */
1318void __cdecl FUN_00402710(LPCSTR param_1,LPCSTR param_2)
1319
1320{
1321 undefined extraout_DL;
1322 LPCSTR unaff_ESI;
1323 LPWSTR pWVar1;
1324 undefined in_stack_fffffde0;
1325 WCHAR local_20c [260];
1326 uint local_4;
1327
1328 local_4 = DAT_0042d008 ^ (uint)&stack0xfffffde0;
1329 pWVar1 = local_20c;
1330 FUN_00404890(pWVar1,param_1,0x104,unaff_ESI);
1331 FUN_00404890((LPWSTR)&stack0xfffffde0,param_2,10,(LPCSTR)pWVar1);
1332 __wfopen(local_20c,(wchar_t *)&stack0xfffffde0);
1333 FUN_004075a4(local_4 ^ (uint)&stack0xfffffde0,extraout_DL,in_stack_fffffde0);
1334 return;
1335}
1336
1337/* Function: FUN_00402780 */
1338bool __cdecl FUN_00402780(char *param_1,size_t param_2,char *param_3)
1339
1340{
1341 char *pcVar1;
1342
1343 pcVar1 = __fullpath(param_1,param_3,param_2);
1344 return pcVar1 != (char *)0x0;
1345}
1346
1347/* Function: thunk_FUN_00402580 */
1348undefined4 __cdecl thunk_FUN_00402580(undefined2 *param_1,undefined4 param_2)
1349
1350{
1351 char cVar1;
1352 int iVar2;
1353 char *pcVar3;
1354 undefined2 *puVar4;
1355
1356 iVar2 = _snprintf((char *)param_1,0x1000,"%s",param_2);
1357 if (0xfff < iVar2) {
1358 return 0;
1359 }
1360 puVar4 = param_1;
1361 do {
1362 cVar1 = *(char *)puVar4;
1363 puVar4 = (undefined2 *)((int)puVar4 + 1);
1364 } while (cVar1 != '\0');
1365 puVar4 = (undefined2 *)((int)puVar4 - ((int)param_1 + 1));
1366 if (*(char *)((int)puVar4 + -1 + (int)param_1) == '\\') {
1367 *(undefined *)((int)puVar4 + -1 + (int)param_1) = 0;
1368 }
1369 pcVar3 = _strrchr((char *)param_1,0x5c);
1370 if (pcVar3 != (char *)0x0) {
1371 *pcVar3 = '\0';
1372 return 1;
1373 }
1374 *param_1 = 0x2e;
1375 return 1;
1376}
1377
1378/* Function: FUN_004027b0 */
1379char * __cdecl FUN_004027b0(char *param_1,undefined4 param_2,char *param_3)
1380
1381{
1382 char cVar1;
1383 uint uVar2;
1384 char *pcVar3;
1385 char *pcVar4;
1386
1387 uVar2 = _snprintf(param_1,0x1000,"%s",param_2);
1388 if (0xffe < uVar2) {
1389 return (char *)0x0;
1390 }
1391 if (param_1[uVar2 - 1] != '\\') {
1392 *(undefined2 *)(param_1 + uVar2) = 0x5c;
1393 uVar2 = uVar2 + 2;
1394 }
1395 pcVar4 = (char *)(0x1000 - uVar2);
1396 pcVar3 = param_3;
1397 do {
1398 cVar1 = *pcVar3;
1399 pcVar3 = pcVar3 + 1;
1400 } while (cVar1 != '\0');
1401 if (pcVar4 <= pcVar3 + -(int)(param_3 + 1)) {
1402 return (char *)0x0;
1403 }
1404 if (param_3[(int)(pcVar3 + -(int)(param_3 + 1) + -1)] == '\\') {
1405 _strncat(param_1,param_3,(size_t)pcVar4);
1406 pcVar3 = param_1;
1407 do {
1408 pcVar4 = pcVar3;
1409 pcVar3 = pcVar4 + 1;
1410 } while (*pcVar4 != '\0');
1411 pcVar4[-1] = '\0';
1412 return param_1;
1413 }
1414 _strncat(param_1,param_3,(size_t)pcVar4);
1415 return param_1;
1416}
1417
1418/* Function: FUN_00402860 */
1419/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
1420
1421undefined4 __cdecl FUN_00402860(HMODULE param_1)
1422
1423{
1424 DAT_0042d970 = GetProcAddress(param_1,"Py_DontWriteBytecodeFlag");
1425 if (DAT_0042d970 == (FARPROC)0x0) {
1426 FUN_00401850("GetProcAddress","Failed to get address for Py_DontWriteBytecodeFlag\n");
1427 return 0xffffffff;
1428 }
1429 _DAT_0042d964 = GetProcAddress(param_1,"Py_FileSystemDefaultEncoding");
1430 if (_DAT_0042d964 == (FARPROC)0x0) {
1431 FUN_00401850("GetProcAddress","Failed to get address for Py_FileSystemDefaultEncoding\n");
1432 return 0xffffffff;
1433 }
1434 DAT_0042d958 = GetProcAddress(param_1,"Py_FrozenFlag");
1435 if (DAT_0042d958 == (FARPROC)0x0) {
1436 FUN_00401850("GetProcAddress","Failed to get address for Py_FrozenFlag\n");
1437 return 0xffffffff;
1438 }
1439 DAT_0042d96c = GetProcAddress(param_1,"Py_IgnoreEnvironmentFlag");
1440 if (DAT_0042d96c == (FARPROC)0x0) {
1441 FUN_00401850("GetProcAddress","Failed to get address for Py_IgnoreEnvironmentFlag\n");
1442 return 0xffffffff;
1443 }
1444 DAT_0042d95c = GetProcAddress(param_1,"Py_NoSiteFlag");
1445 if (DAT_0042d95c == (FARPROC)0x0) {
1446 FUN_00401850("GetProcAddress","Failed to get address for Py_NoSiteFlag\n");
1447 return 0xffffffff;
1448 }
1449 DAT_0042d974 = GetProcAddress(param_1,"Py_NoUserSiteDirectory");
1450 if (DAT_0042d974 == (FARPROC)0x0) {
1451 FUN_00401850("GetProcAddress","Failed to get address for Py_NoUserSiteDirectory\n");
1452 return 0xffffffff;
1453 }
1454 DAT_0042d960 = GetProcAddress(param_1,"Py_OptimizeFlag");
1455 if (DAT_0042d960 == (FARPROC)0x0) {
1456 FUN_00401850("GetProcAddress","Failed to get address for Py_OptimizeFlag\n");
1457 return 0xffffffff;
1458 }
1459 DAT_0042d968 = GetProcAddress(param_1,"Py_VerboseFlag");
1460 if (DAT_0042d968 == (FARPROC)0x0) {
1461 FUN_00401850("GetProcAddress","Failed to get address for Py_VerboseFlag\n");
1462 return 0xffffffff;
1463 }
1464 _DAT_0042d9bc = GetProcAddress(param_1,"Py_BuildValue");
1465 if (_DAT_0042d9bc == (FARPROC)0x0) {
1466 FUN_00401850("GetProcAddress","Failed to get address for Py_BuildValue\n");
1467 return 0xffffffff;
1468 }
1469 _DAT_0042d984 = GetProcAddress(param_1,"Py_DecRef");
1470 if (_DAT_0042d984 == (FARPROC)0x0) {
1471 FUN_00401850("GetProcAddress","Failed to get address for Py_DecRef\n");
1472 return 0xffffffff;
1473 }
1474 _DAT_0042d97c = GetProcAddress(param_1,"Py_Finalize");
1475 if (_DAT_0042d97c == (FARPROC)0x0) {
1476 FUN_00401850("GetProcAddress","Failed to get address for Py_Finalize\n");
1477 return 0xffffffff;
1478 }
1479 _DAT_0042d980 = GetProcAddress(param_1,"Py_IncRef");
1480 if (_DAT_0042d980 == (FARPROC)0x0) {
1481 FUN_00401850("GetProcAddress","Failed to get address for Py_IncRef\n");
1482 return 0xffffffff;
1483 }
1484 _DAT_0042d978 = GetProcAddress(param_1,"Py_Initialize");
1485 if (_DAT_0042d978 == (FARPROC)0x0) {
1486 FUN_00401850("GetProcAddress","Failed to get address for Py_Initialize\n");
1487 return 0xffffffff;
1488 }
1489 _DAT_0042d990 = GetProcAddress(param_1,"Py_SetPath");
1490 if (_DAT_0042d990 == (FARPROC)0x0) {
1491 FUN_00401850("GetProcAddress","Failed to get address for Py_SetPath\n");
1492 return 0xffffffff;
1493 }
1494 _DAT_0042d994 = GetProcAddress(param_1,"Py_GetPath");
1495 if (_DAT_0042d994 == (FARPROC)0x0) {
1496 FUN_00401850("GetProcAddress","Failed to get address for Py_GetPath\n");
1497 return 0xffffffff;
1498 }
1499 _DAT_0042d988 = GetProcAddress(param_1,"Py_SetProgramName");
1500 if (_DAT_0042d988 == (FARPROC)0x0) {
1501 FUN_00401850("GetProcAddress","Failed to get address for Py_SetProgramName\n");
1502 return 0xffffffff;
1503 }
1504 _DAT_0042d98c = GetProcAddress(param_1,"Py_SetPythonHome");
1505 if (_DAT_0042d98c == (FARPROC)0x0) {
1506 FUN_00401850("GetProcAddress","Failed to get address for Py_SetPythonHome\n");
1507 return 0xffffffff;
1508 }
1509 _DAT_0042d9d0 = GetProcAddress(param_1,"PyDict_GetItemString");
1510 if (_DAT_0042d9d0 == (FARPROC)0x0) {
1511 FUN_00401850("GetProcAddress","Failed to get address for PyDict_GetItemString\n");
1512 return 0xffffffff;
1513 }
1514 _DAT_0042d9d4 = GetProcAddress(param_1,"PyErr_Clear");
1515 if (_DAT_0042d9d4 == (FARPROC)0x0) {
1516 FUN_00401850("GetProcAddress","Failed to get address for PyErr_Clear\n");
1517 return 0xffffffff;
1518 }
1519 _DAT_0042d9d8 = GetProcAddress(param_1,"PyErr_Occurred");
1520 if (_DAT_0042d9d8 == (FARPROC)0x0) {
1521 FUN_00401850("GetProcAddress","Failed to get address for PyErr_Occurred\n");
1522 return 0xffffffff;
1523 }
1524 _DAT_0042d9dc = GetProcAddress(param_1,"PyErr_Print");
1525 if (_DAT_0042d9dc == (FARPROC)0x0) {
1526 FUN_00401850("GetProcAddress","Failed to get address for PyErr_Print\n");
1527 return 0xffffffff;
1528 }
1529 _DAT_0042da08 = GetProcAddress(param_1,"PyErr_Fetch");
1530 if (_DAT_0042da08 == (FARPROC)0x0) {
1531 FUN_00401850("GetProcAddress","Failed to get address for PyErr_Fetch\n");
1532 return 0xffffffff;
1533 }
1534 _DAT_0042d9ac = GetProcAddress(param_1,"PyImport_AddModule");
1535 if (_DAT_0042d9ac == (FARPROC)0x0) {
1536 FUN_00401850("GetProcAddress","Failed to get address for PyImport_AddModule\n");
1537 return 0xffffffff;
1538 }
1539 _DAT_0042d9a4 = GetProcAddress(param_1,"PyImport_ExecCodeModule");
1540 if (_DAT_0042d9a4 == (FARPROC)0x0) {
1541 FUN_00401850("GetProcAddress","Failed to get address for PyImport_ExecCodeModule\n");
1542 return 0xffffffff;
1543 }
1544 _DAT_0042d9a8 = GetProcAddress(param_1,"PyImport_ImportModule");
1545 if (_DAT_0042d9a8 == (FARPROC)0x0) {
1546 FUN_00401850("GetProcAddress","Failed to get address for PyImport_ImportModule\n");
1547 return 0xffffffff;
1548 }
1549 _DAT_0042d9b8 = GetProcAddress(param_1,"PyList_Append");
1550 if (_DAT_0042d9b8 == (FARPROC)0x0) {
1551 FUN_00401850("GetProcAddress","Failed to get address for PyList_Append\n");
1552 return 0xffffffff;
1553 }
1554 _DAT_0042d9b4 = GetProcAddress(param_1,"PyList_New");
1555 if (_DAT_0042d9b4 == (FARPROC)0x0) {
1556 FUN_00401850("GetProcAddress","Failed to get address for PyList_New\n");
1557 return 0xffffffff;
1558 }
1559 _DAT_0042d9e4 = GetProcAddress(param_1,"PyLong_AsLong");
1560 if (_DAT_0042d9e4 == (FARPROC)0x0) {
1561 FUN_00401850("GetProcAddress","Failed to get address for PyLong_AsLong\n");
1562 return 0xffffffff;
1563 }
1564 _DAT_0042d9cc = GetProcAddress(param_1,"PyModule_GetDict");
1565 if (_DAT_0042d9cc == (FARPROC)0x0) {
1566 FUN_00401850("GetProcAddress","Failed to get address for PyModule_GetDict\n");
1567 return 0xffffffff;
1568 }
1569 _DAT_0042d9c4 = GetProcAddress(param_1,"PyObject_CallFunction");
1570 if (_DAT_0042d9c4 == (FARPROC)0x0) {
1571 FUN_00401850("GetProcAddress","Failed to get address for PyObject_CallFunction\n");
1572 return 0xffffffff;
1573 }
1574 _DAT_0042d9c8 = GetProcAddress(param_1,"PyObject_CallFunctionObjArgs");
1575 if (_DAT_0042d9c8 == (FARPROC)0x0) {
1576 FUN_00401850("GetProcAddress","Failed to get address for PyObject_CallFunctionObjArgs\n");
1577 return 0xffffffff;
1578 }
1579 _DAT_0042d9b0 = GetProcAddress(param_1,"PyObject_SetAttrString");
1580 if (_DAT_0042d9b0 == (FARPROC)0x0) {
1581 FUN_00401850("GetProcAddress","Failed to get address for PyObject_SetAttrString\n");
1582 return 0xffffffff;
1583 }
1584 _DAT_0042da10 = GetProcAddress(param_1,"PyObject_GetAttrString");
1585 if (_DAT_0042da10 == (FARPROC)0x0) {
1586 FUN_00401850("GetProcAddress","Failed to get address for PyObject_GetAttrString\n");
1587 return 0xffffffff;
1588 }
1589 _DAT_0042da0c = GetProcAddress(param_1,"PyObject_Str");
1590 if (_DAT_0042da0c == (FARPROC)0x0) {
1591 FUN_00401850("GetProcAddress","Failed to get address for PyObject_Str\n");
1592 return 0xffffffff;
1593 }
1594 _DAT_0042d9a0 = GetProcAddress(param_1,"PyRun_SimpleString");
1595 if (_DAT_0042d9a0 == (FARPROC)0x0) {
1596 FUN_00401850("GetProcAddress","Failed to get address for PyRun_SimpleString\n");
1597 return 0xffffffff;
1598 }
1599 _DAT_0042d9e0 = GetProcAddress(param_1,"PySys_AddWarnOption");
1600 if (_DAT_0042d9e0 == (FARPROC)0x0) {
1601 FUN_00401850("GetProcAddress","Failed to get address for PySys_AddWarnOption\n");
1602 return 0xffffffff;
1603 }
1604 _DAT_0042d99c = GetProcAddress(param_1,"PySys_SetArgvEx");
1605 if (_DAT_0042d99c == (FARPROC)0x0) {
1606 FUN_00401850("GetProcAddress","Failed to get address for PySys_SetArgvEx\n");
1607 return 0xffffffff;
1608 }
1609 _DAT_0042d9f0 = GetProcAddress(param_1,"PySys_GetObject");
1610 if (_DAT_0042d9f0 == (FARPROC)0x0) {
1611 FUN_00401850("GetProcAddress","Failed to get address for PySys_GetObject\n");
1612 return 0xffffffff;
1613 }
1614 _DAT_0042d9e8 = GetProcAddress(param_1,"PySys_SetObject");
1615 if (_DAT_0042d9e8 == (FARPROC)0x0) {
1616 FUN_00401850("GetProcAddress","Failed to get address for PySys_SetObject\n");
1617 return 0xffffffff;
1618 }
1619 _DAT_0042d998 = GetProcAddress(param_1,"PySys_SetPath");
1620 if (_DAT_0042d998 == (FARPROC)0x0) {
1621 FUN_00401850("GetProcAddress","Failed to get address for PySys_SetPath\n");
1622 return 0xffffffff;
1623 }
1624 _DAT_0042da00 = GetProcAddress(param_1,"PyEval_EvalCode");
1625 if (_DAT_0042da00 == (FARPROC)0x0) {
1626 FUN_00401850("GetProcAddress","Failed to get address for PyEval_EvalCode\n");
1627 return 0xffffffff;
1628 }
1629 _DAT_0042da04 = GetProcAddress(param_1,"PyMarshal_ReadObjectFromString");
1630 if (_DAT_0042da04 == (FARPROC)0x0) {
1631 FUN_00401850("GetProcAddress","Failed to get address for PyMarshal_ReadObjectFromString\n");
1632 return 0xffffffff;
1633 }
1634 _DAT_0042d9c0 = GetProcAddress(param_1,"PyUnicode_FromString");
1635 if (_DAT_0042d9c0 == (FARPROC)0x0) {
1636 FUN_00401850("GetProcAddress","Failed to get address for PyUnicode_FromString\n");
1637 return 0xffffffff;
1638 }
1639 _DAT_0042d9ec = GetProcAddress(param_1,"Py_DecodeLocale");
1640 if (_DAT_0042d9ec == (FARPROC)0x0) {
1641 FUN_00401850("GetProcAddress","Failed to get address for Py_DecodeLocale\n");
1642 return 0xffffffff;
1643 }
1644 _DAT_0042d9f4 = GetProcAddress(param_1,"PyUnicode_FromFormat");
1645 if (_DAT_0042d9f4 == (FARPROC)0x0) {
1646 FUN_00401850("GetProcAddress","Failed to get address for PyUnicode_FromFormat\n");
1647 return 0xffffffff;
1648 }
1649 _DAT_0042d9fc = GetProcAddress(param_1,"PyUnicode_Decode");
1650 if (_DAT_0042d9fc == (FARPROC)0x0) {
1651 FUN_00401850("GetProcAddress","Failed to get address for PyUnicode_Decode\n");
1652 return 0xffffffff;
1653 }
1654 _DAT_0042d9f8 = GetProcAddress(param_1,"PyUnicode_DecodeFSDefault");
1655 if (_DAT_0042d9f8 == (FARPROC)0x0) {
1656 FUN_00401850("GetProcAddress","Failed to get address for PyUnicode_DecodeFSDefault\n");
1657 return 0xffffffff;
1658 }
1659 _DAT_0042da14 = GetProcAddress(param_1,"PyUnicode_AsUTF8");
1660 if (_DAT_0042da14 == (FARPROC)0x0) {
1661 FUN_00401850("GetProcAddress","Failed to get address for PyUnicode_AsUTF8\n");
1662 return 0xffffffff;
1663 }
1664 return 0;
1665}
1666
1667/* Function: FUN_00403030 */
1668/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
1669
1670void __cdecl FUN_00403030(int param_1)
1671
1672{
1673 if (*(int *)(param_1 + 0x406c) == 1) {
1674 (*_DAT_0042d9a0)(
1675 "import sys; sys.stdout.flush(); (sys.__stdout__.flush if sys.__stdout__ is not sys.stdout else (lambda: None))()"
1676 );
1677 (*_DAT_0042d9a0)(
1678 "import sys; sys.stderr.flush(); (sys.__stderr__.flush if sys.__stderr__ is not sys.stderr else (lambda: None))()"
1679 );
1680 /* WARNING: Could not recover jumptable at 0x00403056. Too many branches */
1681 /* WARNING: Treating indirect jump as call */
1682 (*_DAT_0042d97c)();
1683 return;
1684 }
1685 return;
1686}
1687
1688/* Function: FUN_00403060 */
1689/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
1690
1691undefined4 __cdecl FUN_00403060(FILE **param_1)
1692
1693{
1694 char cVar1;
1695 int iVar2;
1696 undefined4 uVar3;
1697 void *_Memory;
1698 u_long uVar4;
1699 int iVar5;
1700 FILE *pFVar6;
1701 FILE **ppFVar7;
1702
1703 ppFVar7 = param_1 + 0xc1a;
1704 do {
1705 cVar1 = *(char *)ppFVar7;
1706 ppFVar7 = (FILE **)((int)ppFVar7 + 1);
1707 } while (cVar1 != '\0');
1708 iVar2 = (*_DAT_0042d9fc)(param_1 + 0xc1a,(FILE **)((int)ppFVar7 - ((int)param_1 + 0x3069)),"utf-8"
1709 ,"strict");
1710 if (iVar2 != 0) {
1711 (*_DAT_0042d9e8)("_MEIPASS",iVar2);
1712 uVar3 = (*_DAT_0042d9a8)("marshal");
1713 uVar3 = (*_DAT_0042d9cc)(uVar3);
1714 uVar3 = (*_DAT_0042d9d0)(uVar3,"loads");
1715 pFVar6 = param_1[2];
1716 if (pFVar6 < param_1[3]) {
1717 do {
1718 cVar1 = *(char *)((int)&pFVar6->_file + 1);
1719 if ((cVar1 == 'm') || (cVar1 == 'M')) {
1720 _Memory = FUN_00401220(param_1,(uint *)pFVar6);
1721 if (DAT_0042d954 < 0x25) {
1722 uVar4 = htonl(pFVar6->_flag);
1723 iVar5 = uVar4 - 0xc;
1724 iVar2 = (int)_Memory + 0xc;
1725 }
1726 else {
1727 uVar4 = htonl(pFVar6->_flag);
1728 iVar5 = uVar4 - 0x10;
1729 iVar2 = (int)_Memory + 0x10;
1730 }
1731 iVar2 = (*_DAT_0042d9c4)(uVar3,&DAT_0042255c,iVar2,iVar5);
1732 if ((iVar2 == 0) || (iVar2 = (*_DAT_0042d9a4)((int)&pFVar6->_file + 2,iVar2), iVar2 == 0))
1733 {
1734 FUN_00401820("mod is NULL - %s");
1735 }
1736 iVar2 = (*_DAT_0042d9d8)();
1737 if (iVar2 != 0) {
1738 (*_DAT_0042d9dc)();
1739 (*_DAT_0042d9d4)();
1740 }
1741 FID_conflict__free(_Memory);
1742 }
1743 pFVar6 = (FILE *)FUN_00401530((int)param_1,(u_long *)pFVar6);
1744 } while (pFVar6 < param_1[3]);
1745 }
1746 return 0;
1747 }
1748 FUN_00401820("Failed to get _MEIPASS as PyObject.\n");
1749 return 0xffffffff;
1750}
1751
1752/* Function: FUN_004031a0 */
1753/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
1754
1755undefined4 __cdecl FUN_004031a0(int param_1)
1756
1757{
1758 char cVar1;
1759 u_long uVar2;
1760 char *pcVar3;
1761 undefined4 uVar4;
1762 undefined4 uVar5;
1763 int iVar6;
1764 u_long *puVar7;
1765
1766 puVar7 = *(u_long **)(param_1 + 8);
1767 if (puVar7 < *(u_long **)(param_1 + 0xc)) {
1768 do {
1769 if (*(char *)((int)puVar7 + 0x11) == 'z') {
1770 uVar2 = htonl(puVar7[1]);
1771 iVar6 = *(int *)(param_1 + 4);
1772 pcVar3 = (char *)(param_1 + 0x68);
1773 do {
1774 cVar1 = *pcVar3;
1775 pcVar3 = pcVar3 + 1;
1776 } while (cVar1 != '\0');
1777 uVar4 = (*_DAT_0042d9fc)((char *)(param_1 + 0x68),pcVar3 + -(param_1 + 0x69),"utf-8",
1778 "strict");
1779 uVar5 = (*_DAT_0042d9f4)("%U?%d",uVar4,uVar2 + iVar6);
1780 (*_DAT_0042d984)(uVar4);
1781 iVar6 = (*_DAT_0042d9f0)(&DAT_0042257c);
1782 if (iVar6 == 0) {
1783 FUN_00401820("Installing PYZ: Could not get sys.path\n");
1784 (*_DAT_0042d984)(uVar5);
1785 }
1786 else {
1787 iVar6 = (*_DAT_0042d9b8)(iVar6,uVar5);
1788 if (iVar6 != 0) {
1789 FUN_00401820("Failed to append to sys.path\n");
1790 }
1791 }
1792 }
1793 puVar7 = (u_long *)FUN_00401530(param_1,puVar7);
1794 } while (puVar7 < *(u_long **)(param_1 + 0xc));
1795 }
1796 return 0;
1797}
1798
1799/* Function: FUN_00403270 */
1800/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
1801
1802void __cdecl FUN_00403270(int param_1)
1803
1804{
1805 uint uVar1;
1806 char *pcVar2;
1807 int iVar3;
1808 HMODULE pHVar4;
1809 undefined extraout_DL;
1810 undefined extraout_DL_00;
1811 undefined extraout_DL_01;
1812 char in_stack_ffffdfbc;
1813 char local_2004 [4096];
1814 char local_1004 [4096];
1815 uint local_4;
1816
1817 local_4 = DAT_0042d008 ^ (uint)&stack0xffffdfbc;
1818 uVar1 = _snprintf(&stack0xffffdfbc,0x40,"%s",param_1 + 0x28);
1819 if (0x3f < uVar1) {
1820 FUN_00401820("Reported length (%d) of DLL name (%s) length exceeds buffer[%d] space\n");
1821 FUN_004075a4(local_4 ^ (uint)&stack0xffffdfbc,extraout_DL,in_stack_ffffdfbc);
1822 return;
1823 }
1824 if (*(int *)(param_1 + 0x4068) != 0) {
1825 pcVar2 = FUN_004027b0(local_2004,param_1 + 0x2068,"ucrtbase.dll");
1826 if (pcVar2 == (char *)0x0) {
1827 FUN_00401820("Path of ucrtbase.dll (%s) length exceeds buffer[%d] space\n");
1828 }
1829 iVar3 = FUN_004026b0(local_2004);
1830 if (iVar3 != 0) {
1831 FUN_00404270(local_2004);
1832 }
1833 }
1834 pcVar2 = FUN_004027b0(local_1004,param_1 + 0x3068,&stack0xffffdfbc);
1835 if (pcVar2 == (char *)0x0) {
1836 FUN_00401820("Path of DLL (%s) length exceeds buffer[%d] space\n");
1837 }
1838 pHVar4 = FUN_00404270(local_1004);
1839 if (pHVar4 == (HMODULE)0x0) {
1840 FUN_00401850("LoadLibrary","Error loading Python DLL \'%s\'.\n");
1841 FUN_004075a4(local_4 ^ (uint)&stack0xffffdfbc,extraout_DL_00,in_stack_ffffdfbc);
1842 return;
1843 }
1844 FUN_00402860(pHVar4);
1845 FUN_004075a4(local_4 ^ (uint)&stack0xffffdfbc,extraout_DL_01,in_stack_ffffdfbc);
1846 return;
1847}
1848
1849/* Function: FUN_004033e0 */
1850/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
1851/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
1852
1853void __cdecl FUN_004033e0(int param_1)
1854
1855{
1856 bool bVar1;
1857 int iVar2;
1858 size_t sVar3;
1859 undefined4 *puVar4;
1860 u_long *puVar5;
1861 FILE *pFVar6;
1862 undefined in_DL;
1863 undefined extraout_DL;
1864 undefined extraout_DL_00;
1865 undefined extraout_DL_01;
1866 int iVar7;
1867 char *pcVar8;
1868 undefined in_stack_ffffdff8;
1869 uint local_4;
1870
1871 local_4 = DAT_0042d008 ^ (uint)&stack0xffffdff8;
1872 bVar1 = false;
1873 puVar5 = *(u_long **)(param_1 + 8);
1874 *DAT_0042d95c = 1;
1875 *DAT_0042d958 = 1;
1876 *DAT_0042d970 = 1;
1877 *DAT_0042d974 = 1;
1878 *DAT_0042d96c = 1;
1879 *DAT_0042d968 = 0;
1880 if (puVar5 < *(u_long **)(param_1 + 0xc)) {
1881 do {
1882 if (*(char *)((int)puVar5 + 0x11) != 'o') goto switchD_0040347f_caseD_50;
1883 iVar2 = _strncmp((char *)((int)puVar5 + 0x12),"pyi-",4);
1884 if (iVar2 == 0) goto switchD_0040347f_caseD_50;
1885 switch(*(char *)((int)puVar5 + 0x12)) {
1886 case 'O':
1887 puVar4 = DAT_0042d960;
1888 goto LAB_004034c8;
1889 case 'W':
1890 sVar3 = _mbstowcs((wchar_t *)&stack0xffffdff8,(char *)(puVar5 + 5),0x1000);
1891 if (sVar3 == 0xffffffff) {
1892 FUN_00401820("Failed to convert Wflag %s using mbstowcs (invalid multibyte string)\n");
1893 in_DL = extraout_DL_01;
1894 goto LAB_00403582;
1895 }
1896 (*_DAT_0042d9e0)(&stack0xffffdff8);
1897 break;
1898 case 'u':
1899 bVar1 = true;
1900 break;
1901 case 'v':
1902 puVar4 = DAT_0042d968;
1903LAB_004034c8:
1904 *puVar4 = 1;
1905 }
1906switchD_0040347f_caseD_50:
1907 puVar5 = (u_long *)FUN_00401530(param_1,puVar5);
1908 } while (puVar5 < *(u_long **)(param_1 + 0xc));
1909 in_DL = extraout_DL;
1910 if (bVar1) {
1911 iVar7 = 0x8000;
1912 pFVar6 = (FILE *)___acrt_iob_func(0);
1913 iVar2 = __fileno(pFVar6);
1914 __setmode(iVar2,iVar7);
1915 iVar7 = 0x8000;
1916 pFVar6 = (FILE *)___acrt_iob_func(1);
1917 iVar2 = __fileno(pFVar6);
1918 __setmode(iVar2,iVar7);
1919 pFVar6 = (FILE *)___acrt_iob_func(1);
1920 _fflush(pFVar6);
1921 pFVar6 = (FILE *)___acrt_iob_func(2);
1922 _fflush(pFVar6);
1923 pcVar8 = (char *)0x0;
1924 pFVar6 = (FILE *)___acrt_iob_func(0);
1925 _setbuf(pFVar6,pcVar8);
1926 pcVar8 = (char *)0x0;
1927 pFVar6 = (FILE *)___acrt_iob_func(1);
1928 _setbuf(pFVar6,pcVar8);
1929 pcVar8 = (char *)0x0;
1930 pFVar6 = (FILE *)___acrt_iob_func(2);
1931 _setbuf(pFVar6,pcVar8);
1932 in_DL = extraout_DL_00;
1933 }
1934 }
1935LAB_00403582:
1936 FUN_004075a4(local_4 ^ (uint)&stack0xffffdff8,in_DL,in_stack_ffffdff8);
1937 return;
1938}
1939
1940/* Function: FUN_004035f0 */
1941/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
1942
1943undefined4 __cdecl FUN_004035f0(int param_1)
1944
1945{
1946 LPWSTR *ppWVar1;
1947 LPWSTR _Memory;
1948 LPWSTR *_Memory_00;
1949 int unaff_ESI;
1950 undefined4 unaff_EDI;
1951
1952 _Memory_00 = FUN_004049e0(*(LPWSTR *)(param_1 + 0x4070),*(LPCSTR *)(param_1 + 0x4074),unaff_EDI,
1953 unaff_ESI);
1954 if (_Memory_00 != (LPWSTR *)0x0) {
1955 (*_DAT_0042d99c)(*(undefined4 *)(param_1 + 0x4070),_Memory_00,0);
1956 _Memory = *_Memory_00;
1957 ppWVar1 = _Memory_00;
1958 while (_Memory != (LPWSTR)0x0) {
1959 FID_conflict__free(_Memory);
1960 _Memory = ppWVar1[1];
1961 ppWVar1 = ppWVar1 + 1;
1962 }
1963 FID_conflict__free(_Memory_00);
1964 return 0;
1965 }
1966 FUN_00401820("Failed to convert argv to wchar_t\n");
1967 return 0xffffffff;
1968}
1969
1970/* Function: FUN_00403670 */
1971/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */
1972
1973undefined4 __cdecl FUN_00403670(int param_1)
1974
1975{
1976 LPCSTR pCVar1;
1977 LPWSTR pWVar2;
1978 uint uVar3;
1979 int iVar4;
1980 LPCSTR unaff_ESI;
1981 LPCSTR unaff_EDI;
1982 LPCSTR pCVar5;
1983
1984 pWVar2 = FUN_00404890((LPWSTR)&DAT_00433a38,(LPCSTR)(param_1 + 0x68),0x1000,unaff_ESI);
1985 if (pWVar2 == (LPWSTR)0x0) {
1986 FUN_00401820("Failed to convert progname to wchar_t\n");
1987 return 0xffffffff;
1988 }
1989 pCVar5 = &DAT_00433a38;
1990 (*_DAT_0042d988)();
1991 pCVar1 = (LPCSTR)(param_1 + 0x3068);
1992 pWVar2 = FUN_00404890((LPWSTR)&DAT_00431a30,pCVar1,0x1000,pCVar5);
1993 if (pWVar2 == (LPWSTR)0x0) {
1994 FUN_00401820("Failed to convert pyhome to wchar_t\n");
1995 return 0xffffffff;
1996 }
1997 (*_DAT_0042d98c)(&DAT_00431a30);
1998 uVar3 = _snprintf(&DAT_0042da18,0x200e,"%s%cbase_library.zip%c%s",pCVar1,0x5c,0x3b,pCVar1);
1999 if (0x200d < uVar3) {
2000 FUN_00401820("sys.path (based on %s) exceeds buffer[%d] space\n");
2001 return 0xffffffff;
2002 }
2003 pWVar2 = FUN_00404890((LPWSTR)&DAT_0042fa28,&DAT_0042da18,0x1000,unaff_EDI);
2004 if (pWVar2 == (LPWSTR)0x0) {
2005 FUN_00401820("Failed to convert pypath to wchar_t\n");
2006 return 0xffffffff;
2007 }
2008 (*_DAT_0042d994)();
2009 (*_DAT_0042d990)(&DAT_0042fa28);
2010 FUN_004033e0(param_1);
2011 (*_DAT_0042d978)();
2012 (*_DAT_0042d998)(&DAT_0042fa28);
2013 iVar4 = FUN_004035f0(param_1);
2014 if (iVar4 == 0) {
2015 iVar4 = (*_DAT_0042d9d8)();
2016 if (iVar4 == 0) {
2017 return 0;
2018 }
2019 FUN_00401820("Error detected starting Python VM.");
2020 }
2021 return 0xffffffff;
2022}
2023
2024/* Function: FUN_004037b0 */
2025/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
2026
2027void __cdecl FUN_004037b0(LPCSTR param_1,undefined4 param_2,undefined4 param_3)
2028
2029{
2030 FILE *_File;
2031 FILE *_File_00;
2032 int iVar1;
2033 size_t sVar2;
2034 undefined extraout_DL;
2035 undefined extraout_DL_00;
2036 undefined extraout_DL_01;
2037 undefined uVar3;
2038 FILE *_File_01;
2039 undefined in_stack_ffffeffc;
2040 uint local_4;
2041
2042 local_4 = DAT_0042d008 ^ (uint)&stack0xffffeffc;
2043 _File = (FILE *)FUN_00402710(param_1,"rb");
2044 _File_00 = (FILE *)FUN_00403bd0(param_2,param_3);
2045 if (_File == (FILE *)0x0) {
2046 uVar3 = extraout_DL;
2047 _File = _File_00;
2048 if (_File_00 == (FILE *)0x0) goto LAB_004038bc;
2049 }
2050 else {
2051 if (_File_00 != (FILE *)0x0) {
2052 iVar1 = _feof(_File);
2053 do {
2054 if (iVar1 != 0) {
2055LAB_00403886:
2056 _fclose(_File);
2057 _fclose(_File_00);
2058 FUN_004075a4(local_4 ^ (uint)&stack0xffffeffc,extraout_DL_00,in_stack_ffffeffc);
2059 return;
2060 }
2061 sVar2 = _fread(&stack0xffffeffc,1,0x1000,_File);
2062 if (sVar2 != 0) {
2063 sVar2 = _fwrite(&stack0xffffeffc,1,sVar2,_File_00);
2064 _File_01 = _File_00;
2065 if (sVar2 != 0) {
2066 iVar1 = _ferror(_File_00);
2067 goto joined_r0x00403869;
2068 }
2069LAB_0040387b:
2070 _clearerr_s(_File_01);
2071 goto LAB_00403886;
2072 }
2073 iVar1 = _ferror(_File);
2074 _File_01 = _File;
2075joined_r0x00403869:
2076 if (iVar1 != 0) goto LAB_0040387b;
2077 iVar1 = _feof(_File);
2078 } while( true );
2079 }
2080 }
2081 _fclose(_File);
2082 uVar3 = extraout_DL_01;
2083LAB_004038bc:
2084 FUN_004075a4(local_4 ^ (uint)&stack0xffffeffc,uVar3,in_stack_ffffeffc);
2085 return;
2086}
2087
2088/* Function: FUN_004038e0 */
2089undefined4 __cdecl FUN_004038e0(int param_1)
2090
2091{
2092 char *pcVar1;
2093 int iVar2;
2094
2095 if (*(int *)(param_1 + 0x4068) != 1) {
2096 pcVar1 = FUN_004014b0(param_1,"pyi-runtime-tmpdir");
2097 iVar2 = FUN_00403930((LPCSTR)(param_1 + 0x2068),pcVar1);
2098 if (iVar2 == 0) {
2099 FUN_00401820("INTERNAL ERROR: cannot create temporary directory!\n");
2100 return 0xffffffff;
2101 }
2102 *(undefined4 *)(param_1 + 0x4068) = 1;
2103 }
2104 return 0;
2105}
2106
2107/* Function: FUN_00403930 */
2108/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
2109
2110void __cdecl FUN_00403930(LPCSTR param_1,char *param_2)
2111
2112{
2113 LPWSTR pWVar1;
2114 LPWSTR pWVar2;
2115 wchar_t *_Memory;
2116 int iVar3;
2117 undefined extraout_DL;
2118 undefined extraout_DL_00;
2119 undefined extraout_DL_01;
2120 undefined extraout_DL_02;
2121 undefined extraout_DL_03;
2122 undefined extraout_DL_04;
2123 undefined uVar4;
2124 int iVar5;
2125 LPCWSTR unaff_EDI;
2126 LPCSTR pCVar6;
2127 char *pcVar7;
2128 LPCSTR pCVar8;
2129 undefined uVar9;
2130 wchar_t local_3028 [16];
2131 char local_3008 [4100];
2132 WCHAR local_2004 [4096];
2133 uint local_4;
2134
2135 local_4 = DAT_0042d008 ^ (uint)&stack0xffffcfd4;
2136 pCVar8 = param_1;
2137 if (param_2 != (char *)0x0) {
2138 param_1 = (LPCSTR)FUN_00403b20("TMP");
2139 pcVar7 = local_3008;
2140 FUN_00402780(pcVar7,0x1000,param_2);
2141 pCVar6 = (LPCSTR)0x0;
2142 pWVar1 = FUN_00404890((LPWSTR)0x0,"TMP",0,pcVar7);
2143 pWVar2 = FUN_00404890((LPWSTR)0x0,local_3008,0,pCVar6);
2144 FID_conflict___wputenv_s(pWVar1,pWVar2);
2145 FID_conflict__free(pWVar1);
2146 FID_conflict__free(pWVar2);
2147 }
2148 GetTempPathW(0x1000,local_2004);
2149 GetCurrentProcessId();
2150 FUN_004043f0((wchar_t *)local_3028,0x10,(wchar_t *)L"_MEI%d");
2151 iVar5 = 0;
2152 do {
2153 _Memory = __wtempnam(local_2004,local_3028);
2154 iVar3 = FUN_00404720(_Memory);
2155 if (iVar3 == 0) {
2156 FUN_00404930(pCVar8,_Memory,0x1000,unaff_EDI);
2157 uVar9 = SUB41(pCVar8,0);
2158 FID_conflict__free(_Memory);
2159 uVar4 = extraout_DL_02;
2160 if (param_2 != (char *)0x0) {
2161 pCVar8 = (LPCSTR)0x0;
2162 pWVar1 = FUN_00404890((LPWSTR)0x0,"TMP",0,(LPCSTR)unaff_EDI);
2163 if (param_1 == (LPCSTR)0x0) {
2164 SetEnvironmentVariableW(pWVar1,(LPCWSTR)0x0);
2165 FID_conflict__free(pWVar1);
2166 uVar4 = extraout_DL_04;
2167 }
2168 else {
2169 pWVar2 = FUN_00404890((LPWSTR)0x0,param_1,0,pCVar8);
2170 FID_conflict___wputenv_s(pWVar1,pWVar2);
2171 FID_conflict__free(pWVar1);
2172 FID_conflict__free(pWVar2);
2173 FID_conflict__free(param_1);
2174 uVar4 = extraout_DL_03;
2175 }
2176 }
2177 goto LAB_00403af8;
2178 }
2179 FID_conflict__free(_Memory);
2180 iVar5 = iVar5 + 1;
2181 } while (iVar5 < 5);
2182 uVar4 = extraout_DL;
2183 if (param_2 != (char *)0x0) {
2184 pCVar6 = (LPCSTR)0x0;
2185 pWVar1 = FUN_00404890((LPWSTR)0x0,"TMP",0,(LPCSTR)unaff_EDI);
2186 uVar9 = SUB41(pCVar8,0);
2187 if (param_1 != (LPCSTR)0x0) {
2188 pWVar2 = FUN_00404890((LPWSTR)0x0,param_1,0,pCVar6);
2189 FID_conflict___wputenv_s(pWVar1,pWVar2);
2190 FID_conflict__free(pWVar1);
2191 FID_conflict__free(pWVar2);
2192 FID_conflict__free(param_1);
2193 uVar4 = extraout_DL_00;
2194 goto LAB_00403af8;
2195 }
2196 SetEnvironmentVariableW(pWVar1,(LPCWSTR)0x0);
2197 FID_conflict__free(pWVar1);
2198 uVar4 = extraout_DL_01;
2199 }
2200 uVar9 = SUB41(pCVar8,0);
2201LAB_00403af8:
2202 FUN_004075a4(local_4 ^ (uint)&stack0xffffcfd4,uVar4,uVar9);
2203 return;
2204}
2205
2206/* Function: FUN_00403b20 */
2207/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
2208
2209void __cdecl FUN_00403b20(LPCSTR param_1)
2210
2211{
2212 LPWSTR lpName;
2213 DWORD DVar1;
2214 LPSTR _Src;
2215 undefined extraout_DL;
2216 undefined extraout_DL_00;
2217 undefined extraout_DL_01;
2218 undefined uVar2;
2219 undefined uVar3;
2220 LPCWSTR in_stack_ffffbffc;
2221 WCHAR local_2004 [4096];
2222 uint local_4;
2223
2224 local_4 = DAT_0042d008 ^ (uint)&stack0xffffbffc;
2225 lpName = FUN_00404890((LPWSTR)0x0,param_1,0,(LPCSTR)in_stack_ffffbffc);
2226 DVar1 = GetEnvironmentVariableW(lpName,(LPWSTR)&stack0xffffbffc,0x2000);
2227 uVar2 = extraout_DL;
2228 if (DVar1 != 0) {
2229 ExpandEnvironmentStringsW((LPCWSTR)&stack0xffffbffc,local_2004,0x2000);
2230 _Src = FUN_00404930((LPSTR)0x0,(LPCWSTR)&stack0xffffbffc,0,in_stack_ffffbffc);
2231 uVar3 = SUB41(in_stack_ffffbffc,0);
2232 uVar2 = extraout_DL_00;
2233 if ((_Src != (LPSTR)0x0) && (*_Src != '\0')) {
2234 __strdup(_Src);
2235 FUN_004075a4(local_4 ^ (uint)&stack0xffffbffc,extraout_DL_01,uVar3);
2236 return;
2237 }
2238 }
2239 FUN_004075a4(local_4 ^ (uint)&stack0xffffbffc,uVar2,(char)in_stack_ffffbffc);
2240 return;
2241}
2242
2243/* Function: FUN_00403bd0 */
2244/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
2245
2246void __cdecl FUN_00403bd0(undefined4 param_1,undefined4 param_2)
2247
2248{
2249 char *pcVar1;
2250 char cVar2;
2251 int iVar3;
2252 undefined4 *puVar4;
2253 undefined4 *puVar5;
2254 uint uVar6;
2255 undefined extraout_DL;
2256 undefined extraout_DL_00;
2257 undefined uVar7;
2258 undefined *puVar8;
2259 undefined *extraout_EDX;
2260 char *pcVar9;
2261 undefined4 *puVar10;
2262 LPCSTR unaff_EDI;
2263 undefined4 *puVar11;
2264 _stat64i32 in_stack_ffffbfcc;
2265 undefined4 uStack16389;
2266 char local_3004 [4096];
2267 WCHAR local_2004 [4096];
2268 uint local_4;
2269
2270 local_4 = DAT_0042d008 ^ (uint)&stack0xffffbfcc;
2271 iVar3 = _snprintf((char *)((int)&uStack16389 + 1),0x1000,"%s",param_1);
2272 uVar7 = extraout_DL;
2273 if ((0xfff < iVar3) ||
2274 (iVar3 = _snprintf(local_3004,0x1000,"%s",param_2), uVar7 = extraout_DL_00, 0xfff < iVar3)) {
2275 FUN_004075a4(local_4 ^ (uint)&stack0xffffbfcc,uVar7,in_stack_ffffbfcc);
2276 return;
2277 }
2278 pcVar9 = (char *)((int)&uStack16389 + 1);
2279 do {
2280 cVar2 = *pcVar9;
2281 pcVar9 = pcVar9 + 1;
2282 } while (cVar2 != '\0');
2283 pcVar9 = pcVar9 + -((int)&uStack16389 + 2);
2284 puVar4 = (undefined4 *)_strtok(local_3004,(char *)&DAT_00421420);
2285 if (puVar4 != (undefined4 *)0x0) {
2286 while( true ) {
2287 puVar8 = (undefined *)((int)puVar4 + 1);
2288 puVar5 = puVar4;
2289 do {
2290 cVar2 = *(char *)puVar5;
2291 puVar5 = (undefined4 *)((int)puVar5 + 1);
2292 } while (cVar2 != '\0');
2293 pcVar9 = pcVar9 + 1 + (int)((int)puVar5 - (int)puVar8);
2294 if ((char *)0xffe < pcVar9) goto LAB_00403d36;
2295 puVar5 = &uStack16389;
2296 do {
2297 pcVar1 = (char *)((int)puVar5 + 1);
2298 puVar5 = (undefined4 *)((int)puVar5 + 1);
2299 } while (*pcVar1 != '\0');
2300 *(undefined2 *)puVar5 = DAT_00421420;
2301 puVar5 = puVar4;
2302 do {
2303 cVar2 = *(char *)puVar5;
2304 puVar5 = (undefined4 *)((int)puVar5 + 1);
2305 } while (cVar2 != '\0');
2306 puVar11 = &uStack16389;
2307 do {
2308 pcVar1 = (char *)((int)puVar11 + 1);
2309 puVar11 = (undefined4 *)((int)puVar11 + 1);
2310 } while (*pcVar1 != '\0');
2311 uVar6 = (uint)(undefined4 *)((int)puVar5 - (int)puVar4) >> 2;
2312 puVar10 = puVar4;
2313 while (uVar6 != 0) {
2314 uVar6 = uVar6 - 1;
2315 *puVar11 = *puVar10;
2316 puVar10 = puVar10 + 1;
2317 puVar11 = puVar11 + 1;
2318 }
2319 uVar6 = (uint)(undefined4 *)((int)puVar5 - (int)puVar4) & 3;
2320 while (uVar6 != 0) {
2321 uVar6 = uVar6 - 1;
2322 *(undefined *)puVar11 = *(undefined *)puVar10;
2323 puVar10 = (undefined4 *)((int)puVar10 + 1);
2324 puVar11 = (undefined4 *)((int)puVar11 + 1);
2325 }
2326 puVar4 = (undefined4 *)_strtok((char *)0x0,(char *)&DAT_00421420);
2327 if (puVar4 == (undefined4 *)0x0) break;
2328 FUN_00404890(local_2004,(LPCSTR)((int)&uStack16389 + 1),0x1000,unaff_EDI);
2329 iVar3 = FUN_0040d7a9((wchar_t *)local_2004,(_stat64i32 *)&stack0xffffbfcc);
2330 if (iVar3 < 0) {
2331 FUN_00404720(local_2004);
2332 }
2333 }
2334 }
2335 FUN_00404890(local_2004,(LPCSTR)((int)&uStack16389 + 1),0x1000,unaff_EDI);
2336 iVar3 = FUN_0040d7a9((wchar_t *)local_2004,(_stat64i32 *)&stack0xffffbfcc);
2337 if (iVar3 == 0) {
2338 FUN_00401820("WARNING: file already exists but should not: %s\n");
2339 }
2340 FUN_00402710((LPCSTR)((int)&uStack16389 + 1),"wb");
2341 puVar8 = extraout_EDX;
2342LAB_00403d36:
2343 FUN_004075a4(local_4 ^ (uint)&stack0xffffbfcc,(char)puVar8,in_stack_ffffbfcc);
2344 return;
2345}
2346
2347/* Function: FUN_00403dc0 */
2348/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
2349
2350void __cdecl FUN_00403dc0(LPCSTR param_1)
2351
2352{
2353 ushort uVar1;
2354 short sVar2;
2355 HANDLE pvVar3;
2356 uint uVar4;
2357 int iVar5;
2358 ushort *puVar6;
2359 undefined extraout_DL;
2360 undefined4 *puVar7;
2361 short *psVar8;
2362 int iVar9;
2363 undefined4 *puVar10;
2364 LPCWSTR unaff_EDI;
2365 undefined4 *puVar11;
2366 bool bVar12;
2367 undefined uVar13;
2368 byte local_5488;
2369 undefined4 local_5258 [9];
2370 undefined4 local_5234;
2371 undefined4 uStack20522;
2372 undefined auStack20518 [8198];
2373 CHAR local_3020 [4104];
2374 WCHAR local_2018 [4102];
2375 uint local_c;
2376
2377 local_c = DAT_0042d008 ^ (uint)&stack0xffffab74;
2378 FUN_00404890(local_2018,param_1,0x1000,(LPCSTR)unaff_EDI);
2379 iVar9 = 0;
2380 do {
2381 sVar2 = *(short *)((int)local_2018 + iVar9);
2382 *(short *)(auStack20518 + iVar9 + -2) = sVar2;
2383 iVar9 = iVar9 + 2;
2384 } while (sVar2 != 0);
2385 psVar8 = (short *)((int)&uStack20522 + 2);
2386 do {
2387 sVar2 = *psVar8;
2388 psVar8 = psVar8 + 1;
2389 } while (sVar2 != 0);
2390 iVar9 = (int)((int)psVar8 - (int)auStack20518) >> 1;
2391 sVar2 = *(short *)((int)&uStack20522 + iVar9 * 2);
2392 if ((sVar2 != 0x2f) && (sVar2 != 0x5c)) {
2393 puVar7 = &uStack20522;
2394 do {
2395 psVar8 = (short *)((int)puVar7 + 2);
2396 puVar7 = (undefined4 *)((int)puVar7 + 2);
2397 } while (*psVar8 != 0);
2398 iVar9 = iVar9 + 1;
2399 *puVar7 = DAT_00422764;
2400 }
2401 puVar7 = &uStack20522;
2402 do {
2403 psVar8 = (short *)((int)puVar7 + 2);
2404 puVar7 = (undefined4 *)((int)puVar7 + 2);
2405 } while (*psVar8 != 0);
2406 *puVar7 = DAT_00422768;
2407 pvVar3 = (HANDLE)FUN_0040eba1((LPCWSTR)((int)&uStack20522 + 2),(uint *)&local_5488);
2408 if (pvVar3 != (HANDLE)0xffffffff) {
2409 iVar5 = 0x8c;
2410 puVar7 = (undefined4 *)&local_5488;
2411 puVar11 = (undefined4 *)&stack0xffffa938;
2412 while (iVar5 != 0) {
2413 iVar5 = iVar5 + -1;
2414 *puVar11 = *puVar7;
2415 puVar7 = puVar7 + 1;
2416 puVar11 = puVar11 + 1;
2417 }
2418 FUN_004042a0((LPCWSTR)((int)&uStack20522 + 2),iVar9);
2419 iVar5 = FUN_0040ebac(pvVar3,(uint *)&local_5488);
2420 while (iVar5 == 0) {
2421 iVar5 = 0x8c;
2422 puVar7 = (undefined4 *)&local_5488;
2423 puVar11 = local_5258;
2424 while (iVar5 != 0) {
2425 iVar5 = iVar5 + -1;
2426 *puVar11 = *puVar7;
2427 puVar7 = puVar7 + 1;
2428 puVar11 = puVar11 + 1;
2429 }
2430 puVar6 = &DAT_00422758;
2431 puVar7 = &local_5234;
2432 do {
2433 uVar1 = *(ushort *)puVar7;
2434 bVar12 = uVar1 < *puVar6;
2435 if (uVar1 != *puVar6) {
2436LAB_00403f36:
2437 uVar4 = -(uint)bVar12 | 1;
2438 goto LAB_00403f3b;
2439 }
2440 if (uVar1 == 0) break;
2441 uVar1 = *(ushort *)((int)puVar7 + 2);
2442 bVar12 = uVar1 < puVar6[1];
2443 if (uVar1 != puVar6[1]) goto LAB_00403f36;
2444 puVar7 = puVar7 + 1;
2445 puVar6 = puVar6 + 2;
2446 } while (uVar1 != 0);
2447 uVar4 = 0;
2448LAB_00403f3b:
2449 if (uVar4 != 0) {
2450 puVar6 = &DAT_0042275c;
2451 puVar7 = &local_5234;
2452 do {
2453 uVar1 = *(ushort *)puVar7;
2454 bVar12 = uVar1 < *puVar6;
2455 if (uVar1 != *puVar6) {
2456LAB_00403f76:
2457 uVar4 = -(uint)bVar12 | 1;
2458 goto LAB_00403f7b;
2459 }
2460 if (uVar1 == 0) break;
2461 uVar1 = *(ushort *)((int)puVar7 + 2);
2462 bVar12 = uVar1 < puVar6[1];
2463 if (uVar1 != puVar6[1]) goto LAB_00403f76;
2464 puVar7 = puVar7 + 1;
2465 puVar6 = puVar6 + 2;
2466 } while (uVar1 != 0);
2467 uVar4 = 0;
2468LAB_00403f7b:
2469 if (uVar4 != 0) {
2470 *(undefined2 *)(auStack20518 + iVar9 * 2 + -2) = 0;
2471 puVar7 = &local_5234;
2472 do {
2473 sVar2 = *(short *)puVar7;
2474 puVar7 = (undefined4 *)((int)puVar7 + 2);
2475 } while (sVar2 != 0);
2476 puVar7 = (undefined4 *)((int)puVar7 - (int)&local_5234);
2477 puVar11 = &uStack20522;
2478 do {
2479 psVar8 = (short *)((int)puVar11 + 2);
2480 puVar11 = (undefined4 *)((int)puVar11 + 2);
2481 } while (*psVar8 != 0);
2482 uVar4 = (uint)puVar7 >> 2;
2483 puVar10 = &local_5234;
2484 while (uVar4 != 0) {
2485 uVar4 = uVar4 - 1;
2486 *puVar11 = *puVar10;
2487 puVar10 = puVar10 + 1;
2488 puVar11 = puVar11 + 1;
2489 }
2490 uVar4 = (uint)puVar7 & 3;
2491 while (uVar4 != 0) {
2492 uVar4 = uVar4 - 1;
2493 *(undefined *)puVar11 = *(undefined *)puVar10;
2494 puVar10 = (undefined4 *)((int)puVar10 + 1);
2495 puVar11 = (undefined4 *)((int)puVar11 + 1);
2496 }
2497 if ((local_5488 & 0x10) == 0) {
2498 iVar5 = FUN_0040f5c5((LPCWSTR)((int)&uStack20522 + 2));
2499 if (iVar5 != 0) {
2500 Sleep(100);
2501 FUN_0040f5c5((LPCWSTR)((int)&uStack20522 + 2));
2502 }
2503 }
2504 else {
2505 FUN_00404930(local_3020,(LPCWSTR)((int)&uStack20522 + 2),0x1000,unaff_EDI);
2506 FUN_00403dc0(local_3020);
2507 }
2508 }
2509 }
2510 iVar5 = FUN_0040ebac(pvVar3,(uint *)&local_5488);
2511 }
2512 FUN_0040eb7b(pvVar3);
2513 }
2514 uVar13 = SUB41(pvVar3,0);
2515 FUN_0040e88d(local_2018);
2516 FUN_004075a4(local_c ^ (uint)&stack0xffffab74,extraout_DL,uVar13);
2517 return;
2518}
2519
2520/* Function: FUN_00404070 */
2521errno_t __cdecl FUN_00404070(LPCSTR param_1,LPCSTR param_2)
2522
2523{
2524 LPWSTR _Name;
2525 LPWSTR _Value;
2526 errno_t eVar1;
2527 LPCSTR unaff_EDI;
2528 LPCSTR pCVar2;
2529
2530 pCVar2 = (LPCSTR)0x0;
2531 _Name = FUN_00404890((LPWSTR)0x0,param_1,0,unaff_EDI);
2532 _Value = FUN_00404890((LPWSTR)0x0,param_2,0,pCVar2);
2533 eVar1 = FID_conflict___wputenv_s(_Name,_Value);
2534 FID_conflict__free(_Name);
2535 FID_conflict__free(_Value);
2536 return eVar1;
2537}
2538
2539/* Function: FUN_004040b0 */
2540BOOL __cdecl FUN_004040b0(LPCSTR param_1)
2541
2542{
2543 LPWSTR lpName;
2544 BOOL BVar1;
2545 LPCSTR unaff_EDI;
2546
2547 lpName = FUN_00404890((LPWSTR)0x0,param_1,0,unaff_EDI);
2548 BVar1 = SetEnvironmentVariableW(lpName,(LPCWSTR)0x0);
2549 FID_conflict__free(lpName);
2550 return BVar1;
2551}
2552
2553/* Function: FUN_004040e0 */
2554/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
2555
2556void __cdecl FUN_004040e0(LPCSTR param_1)
2557
2558{
2559 FILE *pFVar1;
2560 int iVar2;
2561 LPWSTR lpCommandLine;
2562 undefined extraout_DL;
2563 undefined extraout_DL_00;
2564 _SECURITY_ATTRIBUTES *lpProcessAttributes;
2565 LPSECURITY_ATTRIBUTES lpThreadAttributes;
2566 BOOL BVar3;
2567 DWORD dwCreationFlags;
2568 LPVOID lpEnvironment;
2569 LPCWSTR lpCurrentDirectory;
2570 _STARTUPINFOW *lpStartupInfo;
2571 _PROCESS_INFORMATION *lpProcessInformation;
2572 undefined uVar4;
2573 _SECURITY_ATTRIBUTES local_2064;
2574 _PROCESS_INFORMATION local_2058;
2575 _STARTUPINFOW local_2048;
2576 WCHAR local_2004 [4096];
2577 uint local_4;
2578
2579 local_4 = DAT_0042d008 ^ (uint)&stack0xffffdf98;
2580 uVar4 = 0;
2581 FUN_00404890(local_2004,param_1,0x1000,(LPCSTR)0x0);
2582 _signal(0x16);
2583 _signal(2);
2584 _signal(0xf);
2585 _signal(0x15);
2586 local_2064.nLength = 0xc;
2587 local_2064.lpSecurityDescriptor = (LPVOID)0x0;
2588 local_2064.bInheritHandle = 1;
2589 GetStartupInfoW((LPSTARTUPINFOW)&local_2048);
2590 local_2048.lpReserved = (LPWSTR)0x0;
2591 local_2048.lpDesktop = (LPWSTR)0x0;
2592 local_2048.lpTitle = (LPWSTR)0x0;
2593 local_2048.dwFlags = 0x101;
2594 local_2048.wShowWindow = 1;
2595 pFVar1 = (FILE *)___acrt_iob_func(0);
2596 iVar2 = __fileno(pFVar1);
2597 local_2048.hStdInput = (HANDLE)__get_osfhandle(iVar2);
2598 pFVar1 = (FILE *)___acrt_iob_func(1);
2599 iVar2 = __fileno(pFVar1);
2600 local_2048.hStdOutput = (HANDLE)__get_osfhandle(iVar2);
2601 pFVar1 = (FILE *)___acrt_iob_func(2);
2602 iVar2 = __fileno(pFVar1);
2603 local_2048.hStdError = (HANDLE)__get_osfhandle(iVar2);
2604 lpProcessInformation = &local_2058;
2605 lpStartupInfo = &local_2048;
2606 lpCurrentDirectory = (LPCWSTR)0x0;
2607 lpEnvironment = (LPVOID)0x0;
2608 dwCreationFlags = 0;
2609 BVar3 = 1;
2610 lpThreadAttributes = (LPSECURITY_ATTRIBUTES)0x0;
2611 lpProcessAttributes = &local_2064;
2612 lpCommandLine = GetCommandLineW();
2613 BVar3 = CreateProcessW(local_2004,lpCommandLine,(LPSECURITY_ATTRIBUTES)lpProcessAttributes,
2614 lpThreadAttributes,BVar3,dwCreationFlags,lpEnvironment,lpCurrentDirectory,
2615 (LPSTARTUPINFOW)lpStartupInfo,(LPPROCESS_INFORMATION)lpProcessInformation);
2616 if (BVar3 != 0) {
2617 WaitForSingleObject(local_2058.hProcess,0xffffffff);
2618 GetExitCodeProcess(local_2058.hProcess,(LPDWORD)&stack0xffffdf98);
2619 FUN_004075a4(local_4 ^ (uint)&stack0xffffdf98,extraout_DL,uVar4);
2620 return;
2621 }
2622 FUN_00401850("CreateProcessW","Error creating child process!\n");
2623 FUN_004075a4(local_4 ^ (uint)&stack0xffffdf98,extraout_DL_00,uVar4);
2624 return;
2625}
2626
2627/* Function: FUN_00404270 */
2628HMODULE __cdecl FUN_00404270(LPCSTR param_1)
2629
2630{
2631 LPWSTR lpLibFileName;
2632 HMODULE pHVar1;
2633 LPCSTR unaff_EDI;
2634
2635 lpLibFileName = FUN_00404890((LPWSTR)0x0,param_1,0,unaff_EDI);
2636 pHVar1 = LoadLibraryExW(lpLibFileName,(HANDLE)0x0,8);
2637 FID_conflict__free(lpLibFileName);
2638 return pHVar1;
2639}
2640
2641/* Function: FUN_004042a0 */
2642/* WARNING: Function: __alloca_probe replaced with injection: alloca_probe */
2643
2644void __cdecl FUN_004042a0(LPCWSTR param_1,int param_2)
2645
2646{
2647 short *psVar1;
2648 short sVar2;
2649 uint uVar3;
2650 int iVar4;
2651 ushort *puVar5;
2652 undefined extraout_DL;
2653 undefined extraout_DL_00;
2654 undefined extraout_DL_01;
2655 undefined uVar6;
2656 ushort uVar7;
2657 undefined4 *puVar8;
2658 undefined4 *puVar9;
2659 LPCWSTR unaff_EDI;
2660 undefined4 *puVar10;
2661 bool bVar11;
2662 byte in_stack_ffffedc8;
2663 undefined4 local_1214;
2664 CHAR local_1008 [4100];
2665 uint local_4;
2666
2667 local_4 = DAT_0042d008 ^ (uint)&stack0xffffedc8;
2668 puVar8 = &local_1214;
2669 iVar4 = 0x8c;
2670 puVar10 = (undefined4 *)&stack0x0000000c;
2671 puVar9 = (undefined4 *)&stack0xffffedc8;
2672 while (iVar4 != 0) {
2673 iVar4 = iVar4 + -1;
2674 *puVar9 = *puVar10;
2675 puVar10 = puVar10 + 1;
2676 puVar9 = puVar9 + 1;
2677 }
2678 puVar5 = &DAT_00422758;
2679 do {
2680 uVar7 = *(ushort *)puVar8;
2681 bVar11 = uVar7 < *puVar5;
2682 if (uVar7 != *puVar5) {
2683LAB_0040430b:
2684 uVar6 = (undefined)uVar7;
2685 uVar3 = -(uint)bVar11 | 1;
2686 goto LAB_00404310;
2687 }
2688 if (uVar7 == 0) break;
2689 uVar7 = *(ushort *)((int)puVar8 + 2);
2690 bVar11 = uVar7 < puVar5[1];
2691 if (uVar7 != puVar5[1]) goto LAB_0040430b;
2692 puVar8 = puVar8 + 1;
2693 puVar5 = puVar5 + 2;
2694 } while (uVar7 != 0);
2695 uVar6 = (undefined)uVar7;
2696 uVar3 = 0;
2697LAB_00404310:
2698 if (uVar3 != 0) {
2699 puVar5 = &DAT_0042275c;
2700 puVar8 = &local_1214;
2701 do {
2702 uVar7 = *(ushort *)puVar8;
2703 bVar11 = uVar7 < *puVar5;
2704 if (uVar7 != *puVar5) {
2705LAB_00404347:
2706 uVar6 = (undefined)uVar7;
2707 uVar3 = -(uint)bVar11 | 1;
2708 goto LAB_0040434c;
2709 }
2710 if (uVar7 == 0) break;
2711 uVar7 = *(ushort *)((int)puVar8 + 2);
2712 bVar11 = uVar7 < puVar5[1];
2713 if (uVar7 != puVar5[1]) goto LAB_00404347;
2714 puVar8 = puVar8 + 1;
2715 puVar5 = puVar5 + 2;
2716 } while (uVar7 != 0);
2717 uVar6 = (undefined)uVar7;
2718 uVar3 = 0;
2719LAB_0040434c:
2720 if (uVar3 != 0) {
2721 param_1[param_2] = L'\0';
2722 puVar8 = &local_1214;
2723 do {
2724 sVar2 = *(short *)puVar8;
2725 puVar8 = (undefined4 *)((int)puVar8 + 2);
2726 } while (sVar2 != 0);
2727 puVar8 = (undefined4 *)((int)puVar8 - (int)&local_1214);
2728 puVar10 = (undefined4 *)(param_1 + -1);
2729 do {
2730 psVar1 = (short *)((int)puVar10 + 2);
2731 puVar10 = (undefined4 *)((int)puVar10 + 2);
2732 } while (*psVar1 != 0);
2733 uVar3 = (uint)puVar8 >> 2;
2734 puVar9 = &local_1214;
2735 while (uVar3 != 0) {
2736 uVar3 = uVar3 - 1;
2737 *puVar10 = *puVar9;
2738 puVar9 = puVar9 + 1;
2739 puVar10 = puVar10 + 1;
2740 }
2741 uVar3 = (uint)puVar8 & 3;
2742 while (uVar3 != 0) {
2743 uVar3 = uVar3 - 1;
2744 *(undefined *)puVar10 = *(undefined *)puVar9;
2745 puVar9 = (undefined4 *)((int)puVar9 + 1);
2746 puVar10 = (undefined4 *)((int)puVar10 + 1);
2747 }
2748 if ((in_stack_ffffedc8 & 0x10) == 0) {
2749 iVar4 = FUN_0040f5c5(param_1);
2750 uVar6 = extraout_DL_00;
2751 if (iVar4 != 0) {
2752 Sleep(100);
2753 FUN_0040f5c5(param_1);
2754 uVar6 = extraout_DL_01;
2755 }
2756 }
2757 else {
2758 FUN_00404930(local_1008,param_1,0x1000,unaff_EDI);
2759 FUN_00403dc0(local_1008);
2760 uVar6 = extraout_DL;
2761 }
2762 }
2763 }
2764 FUN_004075a4(local_4 ^ (uint)&stack0xffffedc8,uVar6,in_stack_ffffedc8);
2765 return;
2766}
2767
2768/* Function: FUN_004043f0 */
2769int __cdecl FUN_004043f0(wchar_t *param_1,uint param_2,wchar_t *param_3)
2770
2771{
2772 undefined4 *puVar1;
2773 int iVar2;
2774 __crt_locale_pointers *p_Var3;
2775 char *pcVar4;
2776
2777 pcVar4 = &stack0x00000010;
2778 p_Var3 = (__crt_locale_pointers *)0x0;
2779 puVar1 = (undefined4 *)FUN_004017a0();
2780 iVar2 = ___stdio_common_vswprintf(*puVar1,puVar1[1],param_1,param_2,param_3,p_Var3,pcVar4);
2781 if (iVar2 < 0) {
2782 iVar2 = -1;
2783 }
2784 return iVar2;
2785}
2786