Function at 0x580770
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x1d4
mov eax, dword [0x82aea4]
xor eax, ebp
mov dword [ebp - 4], eax
push ebx
xor ebx, ebx
push esi
push edi
mov dword [ebp - 0xdc], ebx
mov dword [ebp - 0xe0], ebx
cmp byte [ebp + 0xc], bl
je 0x5807a6
mov edi, str.global_pgstat.stat
mov dword [ebp - 0xd4], edi
jmp 0x5807b3
mov eax, dword [sym.postgres.exe_pgstat_stat_filename]
mov dword [ebp - 0xd4], eax
mov edi, eax
mov esi, dword [0x8363ac]
cmp esi, ebx
jne 0x5807e4
mov ecx, dword [sym.postgres.exe_TopMemoryContext]
push 0x2000
push 0x400
push ebx
push str.Statistics_snapshot
push ecx
call sym.postgres.exe_AllocSetContextCreate
mov esi, eax
add esp, 0x14
mov dword [0x8363ac], esi
push 0x34
lea edx, [ebp - 0x11c]
push ebx
push edx
call sub.MSVCR100.dll_memset
push 0x230
lea eax, [ebp - 0x11c]
push eax
push 0x10
push str.Databases_hash
mov dword [ebp - 0x108], 4
mov dword [ebp - 0x104], 0xb8
mov dword [ebp - 0x100], sym.postgres.exe_oid_hash
mov dword [ebp - 0xf0], esi
call sym.postgres.exe_hash_create
push 0x60
mov ebx, eax
push 0
push 0x836308
mov dword [ebp - 0xe4], ebx
call sub.MSVCR100.dll_memset
call sym.postgres.exe_GetCurrentTimestamp
push 0x6bf9bc
push edi
mov dword [0x836360], eax
mov dword [0x836364], edx
call sym.postgres.exe_AllocateFile
mov esi, eax
add esp, 0x30
mov dword [ebp - 0xd8], esi
test esi, esi
jne 0x5808d9
call dword [sym.imp.MSVCR100.dll__errno]
cmp dword [eax], 2
je 0x5808c6
xor ecx, ecx
cmp byte [0x83638a], cl
push esi
sete cl
push str.pgstat_read_statsfile
push 0xe49
push str.src_backendpostmasterpgstat.c
lea ecx, [ecx*4 + 0xf]
push ecx
call sym.postgres.exe_errstart
add esp, 0x14
test al, al
je 0x5808c6
push edi
push str.could_not_open_statistics_file___s_:__m
call sym.postgres.exe_errmsg
add esp, 8
push eax
call sym.postgres.exe_errcode_for_file_access
push eax
call sym.postgres.exe_errfinish
add esp, 8
pop edi
pop esi
mov eax, ebx
pop ebx
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.006a8ca2
mov esp, ebp
pop ebp
ret
mov ebx, dword [sym.imp.MSVCR100.dll_fread]
push esi
push 4
lea edx, [ebp - 0xe8]
push 1
push edx
call ebx
add esp, 0x10
cmp eax, 4
jne 0x580c28
cmp dword [ebp - 0xe8], 0x1a5bc9a
jne 0x580c28
push esi
push 0x60
push 1
push 0x836308
call ebx
add esp, 0x10
cmp eax, 0x60
je 0x580946
push 0
push str.pgstat_read_statsfile
push 0xe5e
xor eax, eax
cmp byte [0x83638a], al
push str.src_backendpostmasterpgstat.c
sete al
lea eax, [eax*4 + 0xf]
push eax
jmp 0x580c4c
push esi
call dword [sym.imp.MSVCR100.dll_fgetc]
sub eax, 0x44
add esp, 4
cmp eax, 0x20
jbe 0x580976
push 0
push str.pgstat_read_statsfile
push 0xf07
jmp 0x580929
mov ebx, dword [sym.imp.MSVCR100.dll_fread]
movzx ecx, byte [eax + 0x580cb8]
jmp dword [ecx*4 + 0x580ca0]
push esi
push 0xb0
lea edx, [ebp - 0x1d4]
push 1
push edx
call ebx
add esp, 0x10
cmp eax, 0xb0
jne 0x580bb6
mov edx, dword [ebp - 0xe4]
lea eax, [ebp - 0xcd]
push eax
push 1
lea ecx, [ebp - 0x1d4]
push ecx
push edx
call sym.postgres.exe_hash_search
add esp, 0x10
cmp byte [ebp - 0xcd], 0
mov ebx, eax
jne 0x580bc7
mov eax, dword [ebp + 8]
xor edx, edx
mov ecx, 0x2e
lea esi, [ebp - 0x1d4]
mov edi, ebx
rep movsd dword es:[edi], dword [esi]
mov dword [ebx + 0xb0], edx
mov dword [ebx + 0xb4], edx
cmp eax, edx
je 0x580a07
mov ecx, dword [ebp - 0x1d4]
cmp ecx, eax
je 0x580a07
cmp ecx, edx
jne 0x580b83
push 0x34
lea eax, [ebp - 0x11c]
push 0
push eax
call sub.MSVCR100.dll_memset
mov ecx, dword [0x8363ac]
push 0x230
lea edx, [ebp - 0x11c]
push edx
push 0x200
mov edi, 4
mov esi, sym.postgres.exe_oid_hash
push str.Per_database_table
mov dword [ebp - 0x108], edi
mov dword [ebp - 0x104], 0xa8
mov dword [ebp - 0x100], esi
mov dword [ebp - 0xf0], ecx
call sym.postgres.exe_hash_create
push 0x230
mov dword [ebx + 0xb0], eax
mov eax, dword [0x8363ac]
lea ecx, [ebp - 0x11c]
push ecx
push 0x200
push str.Per_database_function
mov dword [ebp - 0x108], edi
mov dword [ebp - 0x104], 0x20
mov dword [ebp - 0x100], esi
mov dword [ebp - 0xf0], eax
call sym.postgres.exe_hash_create
mov edx, dword [ebx + 0xb0]
add esp, 0x2c
mov dword [ebx + 0xb4], eax
mov dword [ebp - 0xdc], edx
mov dword [ebp - 0xe0], eax
jmp 0x580b83
xor eax, eax
mov dword [ebp - 0xdc], eax
mov dword [ebp - 0xe0], eax
jmp 0x580b8f
push esi
push 0xa8
lea eax, [ebp - 0xcc]
push 1
push eax
call ebx
add esp, 0x10
cmp eax, 0xa8
jne 0x580bd5
mov eax, dword [ebp - 0xdc]
test eax, eax
je 0x580b8f
lea ecx, [ebp - 0xcd]
push ecx
push 1
lea edx, [ebp - 0xcc]
push edx
push eax
call sym.postgres.exe_hash_search
add esp, 0x10
cmp byte [ebp - 0xcd], 0
jne 0x580bfb
mov ecx, 0x2a
lea esi, [ebp - 0xcc]
jmp 0x580b7f
push esi
push 0x20
lea eax, [ebp - 0x24]
push 1
push eax
call ebx
add esp, 0x10
cmp eax, 0x20
jne 0x580c0c
mov eax, dword [ebp - 0xe0]
test eax, eax
je 0x580b8f
lea ecx, [ebp - 0xcd]
push ecx
push 1
lea edx, [ebp - 0x24]
push edx
push eax
call sym.postgres.exe_hash_search
add esp, 0x10
cmp byte [ebp - 0xcd], 0
jne 0x580c1a
mov ecx, 8
lea esi, [ebp - 0x24]
mov edi, eax
rep movsd dword es:[edi], dword [esi]
mov esi, dword [ebp - 0xd8]
mov edi, dword [ebp - 0xd4]
push esi
call dword [sym.imp.MSVCR100.dll_fgetc]
sub eax, 0x44
add esp, 4
cmp eax, 0x20
jbe 0x580970
push 0
push str.pgstat_read_statsfile
push 0xf07
jmp 0x580929
push 0
push str.pgstat_read_statsfile
push 0xe75
jmp 0x580929
push 0
push str.pgstat_read_statsfile
push 0xe84
jmp 0x580c34
push 0
push str.pgstat_read_statsfile
push 0xec3
xor edx, edx
cmp byte [0x83638a], dl
push str.src_backendpostmasterpgstat.c
sete dl
lea edx, [edx*4 + 0xf]
push edx
jmp 0x580c4c
push 0
push str.pgstat_read_statsfile
push 0xed5
jmp 0x580929
push 0
push str.pgstat_read_statsfile
push 0xee5
jmp 0x580c34
push 0
push str.pgstat_read_statsfile
push 0xef7
jmp 0x580be1
push 0
push str.pgstat_read_statsfile
push 0xe54
xor ecx, ecx
cmp byte [0x83638a], cl
push str.src_backendpostmasterpgstat.c
sete cl
lea ecx, [ecx*4 + 0xf]
push ecx
call sym.postgres.exe_errstart
add esp, 0x14
test al, al
je case.0x58097d.69
push edi
push str.corrupted_statistics_file___s_
call sym.postgres.exe_errmsg
push eax
call sym.postgres.exe_errfinish
add esp, 0xc
push esi
call sym.postgres.exe_FreeFile
add esp, 4
cmp byte [ebp + 0xc], 0
je 0x580c88
push str.global_pgstat.stat
call sym.postgres.exe_pgunlink
add esp, 4
mov ecx, dword [ebp - 4]
mov eax, dword [ebp - 0xe4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.006a8ca2
mov esp, ebp
pop ebp
ret