Function at 0x40d940
Capabilities:
Check if file exists
Create directory
Get file attributes

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x4609cd
mov eax, dword fs:[0]
push eax
sub esp, 0x5c
mov eax, dword [0x472008]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov esi, ecx
push esi
call dword [sym.imp.KERNEL32.dll_GetFileAttributesW]
cmp eax, 0xffffffff
je 0x40d984
test al, 0x10
je 0x40d984
mov al, 1
jmp 0x40dc59
mov ecx, esi
call fcn.0040f170
test al, al
je 0x40d996
xor al, al
jmp 0x40dc59
mov ecx, esi
call fcn.0040f350
mov dword [ebp - 0x68], eax
xor edi, edi
xor eax, eax
mov dword [ebp - 0x1c], eax
mov dword [ebp - 0x18], eax
mov dword [ebp - 0x14], eax
cmp word [esi], ax
je 0x40d9b9
inc edi
cmp word [esi + edi*2], ax
jne 0x40d9b2
xor ecx, ecx
lea eax, [edi + 1]
mov edx, 2
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.0045e549
add esp, 4
mov dword [ebp - 0x18], edi
mov ebx, eax
mov dword [ebp - 0x14], edi
lea eax, [edi*2 + 2]
mov dword [ebp - 0x1c], ebx
push eax
push esi
push ebx
call sub.msvcrt.dll_memcpy
add esp, 0xc
mov dword [ebp - 4], 0
test edi, edi
je 0x40da4c
lea eax, [ebx - 2]
movzx ecx, word [eax + edi*2]
lea eax, [eax + edi*2]
cmp ecx, 0x5c
je 0x40da26
lea esp, [esp]
cmp cx, 0x2f
je 0x40da26
cmp eax, ebx
je 0x40da4c
movzx ecx, word [eax - 2]
sub eax, 2
cmp ecx, 0x5c
jne 0x40da10
sub eax, ebx
sar eax, 1
js 0x40da4c
lea ecx, [edi - 1]
cmp eax, ecx
jne 0x40da4c
cmp edi, 1
jne 0x40da41
mov byte [ebp - 0x61], 1
jmp 0x40dc4d
mov edi, ecx
xor eax, eax
mov dword [ebp - 0x18], edi
mov word [ebx + ecx*2], ax
xor ecx, ecx
lea esi, [edi + 1]
mov eax, esi
mov edx, 2
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.0045e549
add esp, 4
mov dword [ebp - 0x28], eax
lea ecx, [esi + esi]
mov dword [ebp - 0x24], edi
mov dword [ebp - 0x20], edi
push ecx
push ebx
push eax
call sub.msvcrt.dll_memcpy
add esp, 0xc
mov byte [ebp - 4], 1
mov esi, edi
push 0
push ebx
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
test eax, eax
jne 0x40db8c
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
jne 0x40daf2
lea ecx, [ebp - 0x60]
call fcn.0040d8b0
push 0
push ebx
lea ecx, [ebp - 0x60]
mov byte [ebp - 4], 2
call fcn.0040e000
test al, al
jne 0x40dad1
mov byte [ebp - 4], 1
push dword [ebp - 0x38]
call fcn.0045e2f3
add esp, 4
jmp 0x40daf2
mov ebx, dword [ebp - 0x40]
mov byte [ebp - 4], 1
push dword [ebp - 0x38]
shr ebx, 4
call fcn.0045e2f3
add esp, 4
test bl, 1
mov ebx, dword [ebp - 0x1c]
jne 0x40db8c
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 0xb7
je 0x40dc87
test edi, edi
je 0x40dc87
lea esi, [edi - 1]
movzx eax, word [ebx + esi*2]
lea esi, [ebx + esi*2]
cmp eax, 0x5c
je 0x40db3a
lea ebx, [ebx]
cmp ax, 0x2f
je 0x40db3a
cmp esi, ebx
je 0x40dc87
movzx eax, word [esi - 2]
sub esi, 2
cmp eax, 0x5c
jne 0x40db20
sub esi, ebx
sar esi, 1
js 0x40dc87
test esi, esi
je 0x40dc87
cmp esi, 1
jne 0x40db68
movzx eax, word [ebx]
mov ecx, eax
cmp eax, 0x5c
je 0x40dc87
cmp ecx, 0x2f
je 0x40dc87
lea eax, [esi + 1]
cmp dword [ebp - 0x68], eax
jae 0x40dc87
cmp esi, edi
jae 0x40da87
mov edi, esi
xor eax, eax
mov dword [ebp - 0x18], edi
mov word [ebx + esi*2], ax
jmp 0x40da87
mov edi, dword [ebp - 0x24]
cmp esi, edi
jge 0x40dc3e
jmp 0x40dba0
mov edx, dword [ebp - 0x28]
add edx, 2
movzx eax, word [edx + esi*2]
lea edx, [edx + esi*2]
mov ecx, edx
test ax, ax
je 0x40dbd4
cmp ax, 0x5c
je 0x40dc75
cmp ax, 0x2f
je 0x40dc75
movzx eax, word [ecx + 2]
add ecx, 2
test ax, ax
jne 0x40dbb4
mov esi, edi
cmp esi, dword [ebp - 0x14]
jbe 0x40dc0a
xor ecx, ecx
lea eax, [esi + 1]
mov edx, 2
mul edx
seto cl
neg ecx
or ecx, eax
push ecx
call fcn.0045e549
add esp, 4
mov edi, eax
push ebx
call fcn.0045e2f3
mov ebx, edi
mov dword [ebp - 0x14], esi
add esp, 4
mov dword [ebp - 0x1c], ebx
lea edi, [esi + esi]
test esi, esi
je 0x40dc1e
push edi
push dword [ebp - 0x28]
push ebx
call sub.msvcrt.dll_memcpy
add esp, 0xc
xor eax, eax
mov dword [ebp - 0x18], esi
push eax
push ebx
mov word [edi + ebx], ax
call dword [sym.imp.KERNEL32.dll_CreateDirectoryW]
test eax, eax
je 0x40dc87
mov edi, dword [ebp - 0x24]
cmp esi, edi
jl 0x40dba0
mov byte [ebp - 0x61], 1
push dword [ebp - 0x28]
call fcn.0045e2f3
add esp, 4
push ebx
call fcn.0045e2f3
mov al, byte [ebp - 0x61]
add esp, 4
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.0045e090
mov esp, ebp
pop ebp
ret
sub ecx, edx
sar ecx, 1
js 0x40dbd4
inc esi
add esi, ecx
jmp 0x40dbd6
mov byte [ebp - 0x61], 0
jmp 0x40dc42