4
GENERIC_READ = 0x80000000
5
GENERIC_WRITE = 0x40000000
10
FILE_ATTRIBUTE_NORMAL = 0x80
14
kernel32 = pykd.module("kernel32")
16
HANDLE = pykd.typeInfo("Void*")
17
LPCWSTR = pykd.typeInfo("WChar*")
18
DWORD = pykd.typeInfo("UInt4B")
19
LPSECURITY_ATTRIBUTES = pykd.typeInfo("Void*")
21
CreateFileW_Type = pykd.defineFunction(HANDLE, pykd.callingConvention.NearStd)
22
CreateFileW_Type.append("lpFileName", LPCWSTR )
23
CreateFileW_Type.append("dwDesiredAccess", DWORD )
24
CreateFileW_Type.append("dwShareMode", DWORD )
25
CreateFileW_Type.append("lpSecurityAttributes", LPSECURITY_ATTRIBUTES )
26
CreateFileW_Type.append("dwCreationDisposition", DWORD )
27
CreateFileW_Type.append("dwFlagsAndAttributes", DWORD )
28
CreateFileW_Type.append("hTemplateFile", HANDLE )
30
CreateFileW = pykd.typedVar( CreateFileW_Type, kernel32.CreateFileW )
32
fileHandle = CreateFileW(
33
"C:\\temp\\testfile.txt",
34
GENERIC_READ | GENERIC_WRITE,
38
FILE_ATTRIBUTE_NORMAL,
41
print "File Handle", hex(fileHandle)
43
if __name__ == "__main__":