CreateFileA, CreateFileW don't work in masm64 (Russian Variant)

Viewed 82

I'm using a Russian variant of the MASM64 SDK that can be found here. My code is:

OPTION DOTNAME

option casemap:none

include G:\Programs\Soft\Coding\MASM\masm64\Include\win64.inc
include G:\Programs\Soft\Coding\MASM\masm64\Include\kernel32.inc
include G:\Programs\Soft\Coding\MASM\masm64\Include\user32.inc
include G:\Programs\Soft\Coding\MASM\masm64\Include\ADVAPI32.inc
include G:\Programs\Soft\Coding\MASM\masm64\Include\temphls.inc
include G:\Programs\Soft\Coding\MASM\masm64\Include\unicode_string.inc

includelib G:\Programs\Soft\Coding\MASM\masm64\lib\user32.lib
includelib G:\Programs\Soft\Coding\MASM\masm64\lib\kernel32.lib
includelib G:\Programs\Soft\Coding\MASM\masm64\lib\comctl32.lib
includelib G:\Programs\Soft\Coding\MASM\masm64\lib\gdi32.lib
includelib G:\Programs\Soft\Coding\MASM\masm64\lib\advapi32.lib

.data
nFILE           db 'OSPFv3.txt', 0
.code
WinMain proc 
    ENTER 28, 0
    MOV R11, RDI
    AND SIL, 0C1h
    ROR R8W, 0F8h
    ROL R8B, 09Ah
    ADD RDI, 08h
    NOT RSI
    MOV SIL, AL
    JMP @R11_1
    MOV R8, R11
@R11_1:    
      invoke CreateFile,&nFILE, GENERIC_READ or GENERIC_WRITE, NULL, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL;Создаю файл
      invoke ExitProcess, NULL
WinMain endp
end

CreateFileA doesn't work in this code, and CreateFileW doesn't work either.

This is a screenshot using an ANSI string: enter image description here

This is a screenshot using a Unicode string: enter image description here

It also gives me that my parameters are incorrect. Why, when they all appear to be correct?

EDIT with revised example code:

.data
Ascii_1         db "OSPFv3.txt", 0
Unicode:        du <OSPFv3.txt>, 0
.code
WinMain proc 
      push rbp
      mov rbp,RSP
      sub rsp, 28h 
      invoke CreateFile,&Ascii_1, GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ or FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL;Создаю файл
      invoke ExitProcess, NULL
WinMain endp
end
0 Answers
Related