Function at 0x40108f
Capabilities:
Create directory
Delete directory
Delete file
Query environment variable
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x128
nop
mov eax, dword [0x408f7c]
push eax
mov eax, 1
push eax
call sub.msvcrt.dll_calloc
add esp, 8
mov dword [ebp - 4], eax
mov eax, dword [ebp - 4]
cmp eax, 0
jne 0x4010cb
mov eax, 1
push eax
call sub.msvcrt.dll_exit
add esp, 4
mov eax, dword [0x408f7c]
push eax
mov eax, dword [0x408f78]
push eax
mov eax, dword [ebp - 4]
push eax
mov eax, section..data
push eax
call fcn.00402bf4
add esp, 0x10
cmp eax, 0
jge 0x401102
mov eax, 1
push eax
call sub.msvcrt.dll_exit
add esp, 4
mov eax, 0x408f80
push eax
call sub.msvcrt.dll_getenv
add esp, 4
mov dword [ebp - 8], eax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_strlen
add esp, 4
add eax, 0xe
inc eax
push eax
mov eax, 1
push eax
call sub.msvcrt.dll_calloc
add esp, 8
mov dword [ebp - 0xc], eax
mov eax, 0
mov word [ebp - 0xe], ax
mov eax, dword [ebp - 8]
push eax
call sub.msvcrt.dll_strlen
add esp, 4
add eax, 0xf
movzx ecx, word [ebp - 0xe]
push ecx
mov ecx, dword [ebp - 8]
push ecx
mov ecx, str._s_b2ev__hx
push ecx
push eax
mov eax, dword [ebp - 0xc]
push eax
call sub.msvcrt.dll__snprintf
add esp, 0x14
mov eax, 0
push eax
mov eax, dword [ebp - 0xc]
push eax
call sub.kernel32.dll_CreateDirectoryA
cmp eax, 0
je 0x401188
mov eax, 0
jmp 0x40118d
mov eax, 1
cmp eax, 0
jne 0x40119b
jmp 0x4011a8
movzx eax, word [ebp - 0xe]
mov ecx, eax
inc eax
mov word [ebp - 0xe], ax
jmp 0x40113e
mov eax, dword [ebp - 0xc]
push eax
call sub.msvcrt.dll__chdir
add esp, 4
mov eax, 0x20
push eax
mov eax, 0
push eax
lea eax, [ebp - 0x30]
push eax
call sub.msvcrt.dll_memset
add esp, 0xc
mov eax, dword [ebp - 4]
mov dword [ebp - 0x38], eax
mov eax, dword [0x408f7c]
mov dword [ebp - 0x34], eax
lea eax, [ebp - 0x38]
mov dword [ebp - 0x20], eax
mov eax, section..text
mov dword [ebp - 0x30], eax
mov eax, 0x40106d
mov dword [ebp - 0x28], eax
mov eax, 0x40107e
mov dword [ebp - 0x24], eax
mov eax, 0
mov dword [ebp - 0x118], eax
mov eax, 0
mov dword [ebp - 0x11c], eax
lea eax, [ebp - 0x114]
push eax
lea eax, [ebp - 0x30]
push eax
call fcn.00405f84
add esp, 8
cmp eax, 0
jne 0x401419
mov eax, dword [ebp - 0x104]
cmp eax, 0x30
jne 0x40139c
mov eax, 0x408f90
push eax
lea eax, [ebp - 0x100]
push eax
call sub.msvcrt.dll_fopen
add esp, 8
mov dword [ebp - 0x120], eax
mov eax, dword [ebp - 0x120]
cmp eax, 0
jne 0x401291
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
lea ecx, [ebp - 0x100]
push ecx
mov ecx, str.FATAL:_Cannot_open__s
push ecx
push eax
call sub.msvcrt.dll_fprintf
add esp, 0xc
mov eax, 1
push eax
call sub.msvcrt.dll_exit
add esp, 4
mov eax, dword [ebp - 0x118]
mov ecx, dword [ebp - 0x10c]
cmp eax, ecx
jae 0x401315
mov eax, dword [ebp - 0x10c]
push eax
mov eax, dword [ebp - 0x11c]
push eax
call sub.msvcrt.dll_realloc
add esp, 8
mov dword [ebp - 0x124], eax
mov eax, dword [ebp - 0x124]
cmp eax, 0
jne 0x4012fd
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
lea ecx, [ebp - 0x100]
push ecx
mov ecx, str.FATAL:_Out_of_memory_on_file__s
push ecx
push eax
call sub.msvcrt.dll_fprintf
add esp, 0xc
mov eax, 1
push eax
call sub.msvcrt.dll_exit
add esp, 4
mov eax, dword [ebp - 0x124]
mov dword [ebp - 0x11c], eax
mov eax, dword [ebp - 0x10c]
mov dword [ebp - 0x118], eax
mov eax, dword [ebp - 0x10c]
push eax
mov eax, dword [ebp - 0x11c]
push eax
lea eax, [ebp - 0x30]
push eax
call fcn.0040600f
add esp, 0xc
cmp eax, 0xffffffff
jne 0x401365
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
lea ecx, [ebp - 0x100]
push ecx
mov ecx, str.FATAL:_Incomplete_data_on__s
push ecx
push eax
call sub.msvcrt.dll_fprintf
add esp, 0xc
mov eax, 1
push eax
call sub.msvcrt.dll_exit
add esp, 4
mov eax, dword [ebp - 0x120]
push eax
mov eax, 1
push eax
mov eax, dword [ebp - 0x10c]
push eax
mov eax, dword [ebp - 0x11c]
push eax
call sub.msvcrt.dll_fwrite
add esp, 0x10
mov eax, dword [ebp - 0x120]
push eax
call sub.msvcrt.dll_fclose
add esp, 4
jmp 0x401408
mov eax, dword [ebp - 0x104]
cmp eax, 0x35
jne 0x401408
mov eax, 0
push eax
lea eax, [ebp - 0x100]
push eax
call sub.kernel32.dll_CreateDirectoryA
cmp eax, 0
je 0x4013cd
mov eax, 0
jmp 0x4013d2
mov eax, 1
cmp eax, 0
je 0x401408
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
lea ecx, [ebp - 0x100]
push ecx
mov ecx, str.FATAL:_Cant_create_directory__s
push ecx
push eax
call sub.msvcrt.dll_fprintf
add esp, 0xc
mov eax, 1
push eax
call sub.msvcrt.dll_exit
add esp, 4
lea eax, [ebp - 0x30]
push eax
call fcn.00405e53
add esp, 4
jmp 0x40120f
mov eax, dword [ebp - 0x11c]
push eax
call sub.msvcrt.dll_free
add esp, 4
mov eax, dword [ebp + 0xc]
mov ecx, str.main.bat
mov dword [eax], ecx
mov eax, dword [ebp + 0xc]
mov ecx, dword [ebp + 0xc]
push ecx
mov ecx, dword [eax]
push ecx
mov eax, 0
push eax
call sub.msvcrt.dll__spawnvp
add esp, 0xc
mov dword [ebp - 0x128], eax
lea eax, [ebp - 0x30]
push eax
call fcn.00405e1b
add esp, 4
lea eax, [ebp - 0x114]
push eax
lea eax, [ebp - 0x30]
push eax
call fcn.00405f84
add esp, 8
cmp eax, 0
jne 0x4014c4
mov eax, dword [ebp - 0x104]
cmp eax, 0x30
jne 0x401498
lea eax, [ebp - 0x100]
push eax
call sub.kernel32.dll_DeleteFileA
jmp 0x4014b6
mov eax, dword [ebp - 0x104]
cmp eax, 0x35
jne 0x4014b6
lea eax, [ebp - 0x100]
push eax
call sub.msvcrt.dll__rmdir
add esp, 4
lea eax, [ebp - 0x30]
push eax
call fcn.00405e53
add esp, 4
jmp 0x40145c
lea eax, [ebp - 0x30]
push eax
call fcn.00405dc0
add esp, 4
mov eax, dword [ebp - 4]
push eax
call sub.msvcrt.dll_free
add esp, 4
mov eax, 0x409018
push eax
call sub.msvcrt.dll__chdir
add esp, 4
mov eax, dword [ebp - 0xc]
push eax
call sub.msvcrt.dll__rmdir
add esp, 4
mov eax, dword [ebp - 0xc]
push eax
call sub.msvcrt.dll_free
add esp, 4
mov eax, dword [ebp - 0x128]
leave
ret