Function at 0x549320
Capabilities:
Get common file path

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x424
push ebx
push esi
mov esi, dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov ebx, dword [ebp + 8]
push edi
mov edi, dword [ebp + 0xc]
mov dword [ebp - 0xc], 1
mov dword [ebp - 0x10], 0
cmp dword [edi], 3
jne 0x549369
test byte [ebx + 0x128], 1
jne 0x549369
mov edx, str.SCRATCH
mov ecx, 7
mov dword [ebp - 4], edx
mov dword [ebp - 8], ecx
jmp 0x549631
mov ecx, dword [ebx + 0xbc]
lea eax, [ecx + 4]
cmp eax, 3
ja case.default.0x549380
mov edx, 0x400000
jmp dword [eax*4 + 0x549930]
mov eax, dword [ebx + 0x130]
test ah, 2
je 0x54939a
test dword [ebx + 0x128], edx
je case.0x549380.3
push str.FOR_READ
call fcn.0055ffba
mov edx, eax
add esp, 4
test edx, edx
mov dword [ebp - 4], edx
jne 0x54943d
push 0xfffffffffffffff6
call esi
mov dword [ebx + 0xa8], eax
mov edx, dword [0x5855fc]
jmp 0x549433
mov eax, dword [ebx + 0x130]
test ah, 2
je 0x5493d9
test dword [ebx + 0x128], edx
je case.0x549380.2
push str.FOR_ACCEPT
jmp 0x54939f
mov eax, dword [ebx + 0x130]
test ah, 2
je 0x5493f3
test dword [ebx + 0x128], edx
je case.0x549380.1
push str.FOR_TYPE
jmp 0x549412
mov eax, dword [ebx + 0x130]
test ah, 2
je 0x54940d
test dword [ebx + 0x128], edx
je case.default.0x549380
push str.FOR_PRINT
call fcn.0055ffba
mov edx, eax
add esp, 4
test edx, edx
mov dword [ebp - 4], edx
jne 0x54943d
push 0xfffffffffffffff5
call esi
mov dword [ebx + 0xa8], eax
mov edx, dword [0x585600]
mov dword [ebp - 4], edx
mov dword [ebp - 0xc], 0
mov edi, edx
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
jmp 0x5495c2
mov eax, dword [edi + 4]
test eax, eax
je 0x5494a2
mov ecx, dword [edi + 8]
cmp ecx, 0x100
jle 0x549465
mov ecx, 0x100
mov dword [ebp - 8], ecx
mov esi, eax
mov eax, ecx
lea edx, [ebp - 0x118]
lea edi, [ebp - 0x118]
mov dword [ebp - 4], edx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebp - 4]
mov edx, dword [ebp - 8]
mov esi, dword [sym.imp.KERNEL32.dll_GetStdHandle]
mov byte [edx + ecx], 0
mov edx, dword [ebp - 4]
mov ecx, dword [ebp - 8]
jmp 0x5495c5
push ecx
lea eax, [ebp - 0x118]
push str.FORT_d
push eax
call fcn.0055ff68
lea ecx, [ebp - 0x118]
push ecx
call fcn.0055ffba
mov edx, eax
xor edi, edi
add esp, 0x10
cmp edx, edi
mov dword [ebp - 4], edx
je 0x5494df
mov edi, edx
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
jmp 0x5495c2
mov eax, dword [ebx + 0xbc]
add eax, 4
cmp eax, 0xa
ja case.0x5494f5.1
xor edx, edx
mov dl, byte [eax + 0x549950]
jmp dword [edx*4 + 0x549940]
push 0xfffffffffffffff4
jmp 0x549514
push 0xfffffffffffffff6
call esi
mov dword [ebx + 0xa8], eax
mov edx, dword [0x5855fc]
jmp 0x549522
push 0xfffffffffffffff5
call esi
mov dword [ebx + 0xa8], eax
mov edx, dword [0x585600]
cmp edx, edi
mov dword [ebp - 4], edx
mov dword [ebp - 0xc], edi
je case.0x5494f5.1
mov edi, edx
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
jmp 0x5495c2
mov eax, dword [ebx + 0x130]
test ah, 2
jne 0x5495b0
test byte [ebx + 0x128], 1
je 0x549577
mov edx, dword [ebx + 0x50]
or ecx, 0xffffffff
mov edi, edx
xor eax, eax
mov dword [ebp - 4], edx
repne scasb al, byte es:[edi]
mov eax, dword [ebp + 0xc]
not ecx
mov edi, dword [eax]
dec ecx
test edi, edi
mov dword [ebp - 8], ecx
je 0x5495c5
mov dword [eax], 0
jmp 0x5495c5
mov ecx, dword [ebx + 0xbc]
lea edx, [ebp - 0x118]
push ecx
push str.fort._d
push edx
call fcn.0055ff68
lea edi, [ebp - 0x118]
or ecx, 0xffffffff
xor eax, eax
add esp, 0xc
repne scasb al, byte es:[edi]
not ecx
dec ecx
lea edx, [ebp - 0x118]
mov dword [ebp - 8], ecx
mov dword [ebp - 4], edx
jmp 0x5495c5
lea edx, [ebp - 0x118]
mov byte [ebp - 0x118], 0
mov dword [ebp - 4], edx
xor ecx, ecx
mov dword [ebp - 8], ecx
cmp byte [edx], 0x20
jne 0x5495db
test ecx, ecx
jle 0x5495fb
inc edx
dec ecx
mov dword [ebp - 4], edx
mov dword [ebp - 8], ecx
cmp byte [edx], 0x20
je 0x5495ca
test ecx, ecx
jle 0x5495fb
mov al, byte [edx + ecx - 1]
cmp al, 0x20
je 0x5495eb
test al, al
jne 0x5495f3
dec ecx
test ecx, ecx
mov dword [ebp - 8], ecx
jg 0x5495df
mov esi, dword [sym.imp.KERNEL32.dll_GetStdHandle]
test ecx, ecx
jne 0x549627
mov eax, dword [ebx + 0x130]
test ah, 2
je 0x549627
lea eax, [ebp - 8]
lea ecx, [ebp - 4]
push eax
push ecx
push ebx
call fcn.00549e90
add esp, 0xc
test eax, eax
jne 0x549928
mov edx, dword [ebp - 4]
mov ecx, dword [ebp - 8]
mov eax, dword [ebp - 0xc]
test eax, eax
je 0x549673
mov edi, dword [ebp + 0xc]
mov byte [ecx + edx], 0
mov edx, dword [ebp - 4]
push edx
push ebx
call fcn.00533940
add esp, 8
cmp eax, 0xffffffff
je 0x5496e8
mov ecx, dword [0x599834]
mov dword [ebp - 0xc], 0
test ecx, ecx
jne 0x549661
cmp eax, 0xfffffffa
je 0x549666
cmp eax, 1
jne 0x5496ce
push 0xfffffffffffffff5
call esi
mov dword [ebx + 0xa8], eax
mov edx, dword [ebp - 4]
mov edi, edx
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
sub edi, ecx
mov eax, ecx
mov esi, edi
mov edi, dword [ebp + 0x10]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [0x599834]
test eax, eax
mov eax, dword [ebp - 0xc]
je 0x5498e9
test eax, eax
jne 0x549908
cmp dword [ebx + 0xa8], 0xffffffff
jne 0x549908
mov ecx, dword [ebp - 0x10]
test ecx, ecx
jne 0x5498ed
mov dword [ebx + 0xa8], eax
jmp 0x5498ed
test eax, eax
jne 0x5496d6
push 0xfffffffffffffff6
jmp 0x549668
cmp eax, 2
jne 0x5496df
push 0xfffffffffffffff4
jmp 0x549668
mov dword [ebp - 0x10], 1
jmp 0x549670
mov eax, dword [ebp - 0xc]
test eax, eax
je 0x549670
mov eax, dword [ebx + 0x130]
test ah, 4
je 0x549717
mov eax, dword [edi + 0xc]
test eax, eax
jne 0x549717
cmp dword [edi], 3
jne 0x549670
test byte [ebx + 0x128], 1
jne 0x549670
mov edx, dword [edi + 0xc]
test edx, edx
jne 0x54975a
mov edx, dword [ebp - 4]
lea eax, [ebp - 0x14]
lea ecx, [ebp - 0x21c]
push eax
push ecx
push 0x101
push edx
call dword [sym.imp.KERNEL32.dll_GetFullPathNameA]
test eax, eax
je 0x54974f
cmp eax, 0x101
jae 0x54974f
lea ecx, [ebp - 0x21c]
mov dword [ebp - 8], eax
mov dword [ebp - 4], ecx
xor esi, esi
xor eax, eax
xor edx, edx
jmp 0x5497e5
mov eax, dword [edi + 0x10]
lea ecx, [eax + 1]
cmp ecx, 0x100
jle 0x549774
pop edi
pop esi
mov eax, 0xc000002b
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, eax
mov esi, edx
mov edx, ecx
lea edi, [ebp - 0x21c]
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, edx
and ecx, 3
rep movsb byte es:[edi], byte [esi]
lea ecx, [ebp - 0x21c]
mov byte [ebp + eax - 0x21c], 0
test ecx, ecx
lea esi, [ebp - 0x21c]
je 0x5497d1
cmp byte [ebp - 0x21c], 0x20
jne 0x5497bb
test eax, eax
jle 0x5497d1
mov cl, byte [esi + 1]
inc esi
dec eax
cmp cl, 0x20
je 0x5497ad
test eax, eax
jle 0x5497d1
mov cl, byte [esi + eax - 1]
cmp cl, 0x20
je 0x5497cc
test cl, cl
jne 0x5497d1
dec eax
test eax, eax
jg 0x5497bf
cmp eax, 1
jge 0x5497da
xor edx, edx
jmp 0x5497e5
mov cl, byte [eax + esi]
xor edx, edx
cmp cl, 0x5c
setne dl
mov ecx, dword [ebp + 0xc]
cmp dword [ecx], 3
jne 0x549879
test byte [ebx + 0x128], 1
jne 0x549879
mov eax, dword [ecx + 0xc]
test eax, eax
je 0x549805
mov eax, esi
jmp 0x549844
mov eax, dword [ebx + 0x130]
test ah, 4
je 0x549826
mov byte [ebp - 0x320], 0x2e
mov byte [ebp - 0x31f], 0
lea eax, [ebp - 0x320]
jmp 0x549844
lea edx, [ebp - 0x320]
push edx
push 0x100
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
neg eax
sbb eax, eax
lea ecx, [ebp - 0x320]
and eax, ecx
lea edx, [ebp - 0x424]
push edx
push 0
push 0x5856e0
push eax
call dword [sym.imp.KERNEL32.dll_GetTempFileNameA]
mov eax, dword [ebx + 0x130]
lea edi, [ebp - 0x422]
test ah, 4
jne 0x549675
lea edi, [ebp - 0x424]
jmp 0x549675
mov ecx, dword [ebp - 8]
add ecx, eax
add ecx, edx
cmp ecx, 0x100
jle 0x549894
pop edi
pop esi
mov eax, 0xc000002b
pop ebx
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp + 0x10]
mov ecx, eax
mov ebx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebx
and ecx, 3
test edx, edx
rep movsb byte es:[edi], byte [esi]
je 0x5498b7
mov esi, dword [ebp + 0x10]
mov cl, byte [0x5856dc]
mov byte [eax + esi], cl
mov ebx, dword [ebp + 0x10]
mov ecx, dword [ebp - 8]
mov esi, dword [ebp - 4]
lea edi, [eax + edx]
add edi, ebx
mov ebx, ecx
shr ecx, 2
rep movsd dword es:[edi], dword [esi]
mov ecx, ebx
mov ebx, dword [ebp + 8]
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov ecx, dword [ebp - 8]
add eax, ecx
add eax, edx
mov edx, dword [ebp + 0x10]
mov byte [eax + edx], 0
jmp 0x549693
test eax, eax
jne 0x549908
cmp dword [ebx + 0xa8], 0xffffffff
jne 0x549908
mov ecx, dword [ebp + 0x14]
pop edi
pop esi
xor eax, eax
mov dword [ecx], 1
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp - 0x10]
test ecx, ecx
je 0x549921
mov edx, dword [ebp + 0x14]
pop edi
pop esi
xor eax, eax
mov dword [edx], 1
pop ebx
mov esp, ebp
pop ebp
ret
mov ecx, dword [ebp + 0x14]
mov dword [ecx], eax
xor eax, eax
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret