Function at 0x4027f0
Capabilities:
Delete file
Get common file path

Disassembly:
sub esp, 0x554
mov eax, 0x4000
push ebx
push ebp
mov dword [esp + 0x18], eax
mov dword [esp + 0x10], eax
mov eax, dword [esp + 0x568]
push esi
push edi
lea ecx, [esp + 0x3c]
xor edi, edi
push eax
push ecx
push edi
mov dword [esp + 0x30], edi
xor ebx, ebx
call fcn.00402bf0
add esp, 0xc
test eax, eax
jne 0x402839
or eax, 0xffffffff
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x554
ret 0x10
mov eax, dword [esp + 0x568]
lea edx, [esp + 0x35c]
push 0x104
push edx
push eax
call dword [sym.imp.KERNEL32.dll_GetModuleFileNameA]
lea ecx, [esp + 0x10]
push edi
lea edx, [esp + 0x40]
push ecx
push edx
mov dword [esp + 0x1c], edi
mov dword [esp + 0x28], edi
call sub.WINSPOOL.DRV_OpenPrinterA
test eax, eax
je 0x402a0d
mov ecx, dword [esp + 0x10]
push edi
push edi
lea eax, [esp + 0x44]
push edi
push eax
push ecx
push edi
call sub.WINSPOOL.DRV_DocumentPropertiesA
mov ebp, dword [sym.imp.MSVCRT.dll_malloc]
push eax
mov dword [esp + 0x18], eax
call ebp
mov edx, dword [esp + 0x18]
mov ebx, eax
push edx
call ebp
add esp, 8
mov esi, eax
test ebx, ebx
mov dword [esp + 0x24], esi
je 0x402972
test esi, esi
je 0x402972
mov ecx, dword [esp + 0x10]
push 2
push 0
lea eax, [esp + 0x44]
push ebx
push eax
push ecx
push 0
call sub.WINSPOOL.DRV_DocumentPropertiesA
mov ax, word [ebx + 0x3a]
cmp ax, 0x12c
jl 0x4028f1
cmp ax, 0x4b0
jg 0x4028f1
movsx ecx, ax
mov eax, 0x7eff02
cdq
idiv ecx
mov dword [esp + 0x18], eax
mov dword [esp + 0x20], eax
jmp 0x4028fe
mov eax, 0x1af4
mov dword [esp + 0x18], eax
mov dword [esp + 0x20], eax
mov dx, word [esp + 0x20]
mov word [ebx + 0x2e], 0x100
mov word [ebx + 0x32], dx
mov word [ebx + 0x30], ax
mov eax, dword [esp + 0x300]
cmp eax, 0x1c2
jbe 0x402926
cmp eax, 0x546
jb 0x402934
cmp eax, 0x8ca
jbe 0x40293c
cmp eax, 0xc4e
jae 0x40293c
mov word [ebx + 0x2c], 1
jmp 0x402942
mov word [ebx + 0x2c], 2
mov eax, dword [ebx + 0x28]
test ah, 8
je 0x402957
cmp word [ebx + 0x3c], 1
jne 0x402957
mov word [ebx + 0x3c], 2
push 0xa
mov word [ebx + 0x38], 0x404
mov ecx, dword [esp + 0x14]
push ebx
lea eax, [esp + 0x44]
push esi
push eax
push ecx
push 0
call sub.WINSPOOL.DRV_DocumentPropertiesA
mov eax, dword [esp + 0x10]
lea edx, [esp + 0x14]
push edx
push 0
push 0
push 2
push eax
call sub.WINSPOOL.DRV_GetPrinterA
mov ecx, dword [esp + 0x14]
push ecx
call ebp
mov esi, eax
add esp, 4
test esi, esi
je 0x402a0d
mov eax, dword [esp + 0x14]
mov ecx, dword [esp + 0x10]
lea edx, [esp + 0x14]
push edx
push eax
push esi
push 2
push ecx
call sub.WINSPOOL.DRV_GetPrinterA
test eax, eax
je 0x402a03
mov edx, dword [esi + 0xc]
push str.FILE:
push edx
call dword [sym.imp.MSVCRT.dll_strstr]
add esp, 8
test eax, eax
je 0x402a03
push 0x104
call ebp
add esp, 4
mov ebp, eax
lea eax, [esp + 0x460]
mov dword [esp + 0x1c], ebp
push eax
push 0x104
call dword [sym.imp.KERNEL32.dll_GetTempPathA]
push ebp
push 0
lea ecx, [esp + 0x468]
push 0x40517c
push ecx
call dword [sym.imp.KERNEL32.dll_GetTempFileNameA]
mov edi, ebp
push esi
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
mov eax, dword [esp + 0x10]
xor esi, esi
cmp eax, esi
je 0x402a21
push eax
call sub.WINSPOOL.DRV_ClosePrinter
mov dword [esp + 0x10], esi
mov edx, dword [esp + 0x24]
lea eax, [esp + 0x3c]
push edx
push esi
push eax
push str.WINSPOOL
call dword [sym.imp.GDI32.dll_CreateDCA]
mov ebp, eax
cmp ebp, esi
je 0x402b83
mov eax, dword [esp + 0x23c]
lea ecx, [esp + 0x35c]
lea edx, [esp + 0x13c]
cmp eax, 1
mov dword [esp + 0x28], 0x14
mov dword [esp + 0x2c], ecx
mov dword [esp + 0x30], edx
mov dword [esp + 0x34], esi
mov dword [esp + 0x38], esi
jne 0x402a93
push edi
lea eax, [esp + 0x40]
sub esp, 0x14
mov ecx, 5
mov edi, esp
lea esi, [esp + 0x40]
push 0
push eax
rep movsd dword es:[edi], dword [esi]
push ebp
call fcn.00401c00
jmp 0x402ab6
cmp eax, 2
jne 0x402abd
push edi
mov ecx, 5
sub esp, 0x14
lea esi, [esp + 0x40]
mov edi, esp
rep movsd dword es:[edi], dword [esi]
lea ecx, [esp + 0x54]
push 0
push ecx
push ebp
call fcn.004018c0
mov edi, dword [esp + 0x40]
add esp, 0x24
push ebp
call dword [sym.imp.GDI32.dll_EndPage]
push ebp
call dword [sym.imp.GDI32.dll_EndDoc]
cmp dword [esp + 0x23c], 1
jne 0x402af9
mov eax, dword [esp + 0x318]
test eax, eax
je 0x402af9
mov eax, dword [esp + 0x310]
test eax, eax
jne 0x402af9
lea edx, [esp + 0x3c]
push edx
push ebp
call fcn.00401870
add esp, 8
push ebp
call dword [sym.imp.GDI32.dll_DeleteDC]
test edi, edi
je 0x402b15
push edi
call dword [sym.imp.KERNEL32.dll_DeleteFileA]
push edi
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
mov ecx, dword [esp + 0x248]
mov esi, dword [esp + 0x240]
mov eax, ecx
xor edx, edx
shl eax, 7
sub eax, ecx
mov dword [esp + 0x250], 0
add eax, eax
div esi
movsx ecx, word [esp + 0x20]
cmp eax, ecx
jge 0x402b61
mov ecx, dword [esp + 0x24c]
xor edx, edx
mov eax, ecx
shl eax, 7
sub eax, ecx
add eax, eax
div esi
movsx edx, word [esp + 0x18]
cmp eax, edx
jl 0x402b6c
mov dword [esp + 0x250], 1
mov eax, dword [esp + 0x570]
lea ecx, [esp + 0x3c]
push eax
push ecx
push 0
call fcn.00403220
add esp, 0xc
test ebx, ebx
je 0x402b91
push ebx
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
mov eax, dword [esp + 0x24]
test eax, eax
je 0x402ba3
push eax
call dword [sym.imp.MSVCRT.dll_free]
add esp, 4
mov esi, dword [esp + 0x570]
push 0x5c
push esi
call dword [sym.imp.MSVCRT.dll_strrchr]
add esp, 8
test eax, eax
jne 0x402bbe
mov eax, esi
jmp 0x402bbf
inc eax
push eax
push 0
push 0
push 0
call dword [sym.imp.KERNEL32.dll_CreateEventA]
mov esi, eax
test esi, esi
je 0x402be0
push esi
call dword [sym.imp.KERNEL32.dll_SetEvent]
push esi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x554
ret 0x10