@@ -764,6 +764,172 @@ pub mod types {
764
764
pub type LPMEMORY_BASIC_INFORMATION = * mut MEMORY_BASIC_INFORMATION ;
765
765
}
766
766
}
767
+
768
+ #[ cfg( target_arch = "x86_64" ) ]
769
+ pub mod arch {
770
+ pub mod c95 {
771
+ pub type c_char = i8 ;
772
+ pub type c_schar = i8 ;
773
+ pub type c_uchar = u8 ;
774
+ pub type c_short = i16 ;
775
+ pub type c_ushort = u16 ;
776
+ pub type c_int = i32 ;
777
+ pub type c_uint = u32 ;
778
+ pub type c_long = i32 ;
779
+ pub type c_ulong = u32 ;
780
+ pub type c_float = f32 ;
781
+ pub type c_double = f64 ;
782
+ pub type size_t = u64 ;
783
+ pub type ptrdiff_t = i64 ;
784
+ pub type clock_t = i32 ;
785
+ pub type time_t = i64 ;
786
+ pub type wchar_t = u16 ;
787
+ }
788
+ pub mod c99 {
789
+ pub type c_longlong = i64 ;
790
+ pub type c_ulonglong = u64 ;
791
+ pub type intptr_t = int ;
792
+ pub type uintptr_t = uint ;
793
+ }
794
+ pub mod posix88 {
795
+ pub type off_t = i32 ; // XXX unless _FILE_OFFSET_BITS == 64
796
+ pub type dev_t = u32 ;
797
+ pub type ino_t = i16 ;
798
+ pub type pid_t = i64 ;
799
+ pub type useconds_t = u32 ;
800
+ pub type mode_t = u16 ;
801
+ pub type ssize_t = i64 ;
802
+ }
803
+ pub mod posix01 {
804
+ }
805
+ pub mod posix08 {
806
+ }
807
+ pub mod bsd44 {
808
+ }
809
+ pub mod extra {
810
+ use ptr;
811
+ use libc:: types:: common:: c95:: c_void;
812
+ use libc:: types:: os:: arch:: c95:: { c_char, c_int, c_uint, size_t} ;
813
+ use libc:: types:: os:: arch:: c95:: { c_ulong} ;
814
+ use libc:: types:: os:: arch:: c95:: { wchar_t} ;
815
+ use libc:: types:: os:: arch:: c99:: { c_ulonglong} ;
816
+
817
+ pub type BOOL = c_int ;
818
+ pub type BYTE = u8 ;
819
+ pub type CCHAR = c_char ;
820
+ pub type CHAR = c_char ;
821
+
822
+ pub type DWORD = c_ulong ;
823
+ pub type DWORDLONG = c_ulonglong ;
824
+
825
+ pub type HANDLE = LPVOID ;
826
+ pub type HMODULE = c_uint ;
827
+
828
+ pub type LONG_PTR = i64 ; // changed
829
+
830
+ pub type LPCWSTR = * WCHAR ;
831
+ pub type LPCSTR = * CHAR ;
832
+ pub type LPCTSTR = * CHAR ;
833
+ pub type LPTCH = * CHAR ;
834
+
835
+ pub type LPWSTR = * mut WCHAR ;
836
+ pub type LPSTR = * mut CHAR ;
837
+ pub type LPTSTR = * mut CHAR ;
838
+
839
+ // Not really, but opaque to us.
840
+ pub type LPSECURITY_ATTRIBUTES = LPVOID ;
841
+
842
+ pub type LPVOID = * mut c_void ;
843
+ pub type LPCVOID = * c_void ;
844
+ pub type LPBYTE = * mut BYTE ;
845
+ pub type LPWORD = * mut WORD ;
846
+ pub type LPDWORD = * mut DWORD ;
847
+ pub type LPHANDLE = * mut HANDLE ;
848
+
849
+ pub type LRESULT = LONG_PTR ;
850
+ pub type PBOOL = * mut BOOL ;
851
+ pub type WCHAR = wchar_t ;
852
+ pub type WORD = u16 ;
853
+ pub type SIZE_T = size_t ;
854
+
855
+ pub type time64_t = i64 ;
856
+ pub type int64 = i64 ;
857
+
858
+ pub struct STARTUPINFO {
859
+ cb : DWORD ,
860
+ lpReserved : LPTSTR ,
861
+ lpDesktop : LPTSTR ,
862
+ lpTitle : LPTSTR ,
863
+ dwX : DWORD ,
864
+ dwY : DWORD ,
865
+ dwXSize : DWORD ,
866
+ dwYSize : DWORD ,
867
+ dwXCountChars : DWORD ,
868
+ dwYCountCharts : DWORD ,
869
+ dwFillAttribute : DWORD ,
870
+ dwFlags : DWORD ,
871
+ wShowWindow : WORD ,
872
+ cbReserved2 : WORD ,
873
+ lpReserved2 : LPBYTE ,
874
+ hStdInput : HANDLE ,
875
+ hStdOutput : HANDLE ,
876
+ hStdError : HANDLE
877
+ }
878
+ pub type LPSTARTUPINFO = * mut STARTUPINFO ;
879
+
880
+ pub struct PROCESS_INFORMATION {
881
+ hProcess : HANDLE ,
882
+ hThread : HANDLE ,
883
+ dwProcessId : DWORD ,
884
+ dwThreadId : DWORD
885
+ }
886
+ pub type LPPROCESS_INFORMATION = * mut PROCESS_INFORMATION ;
887
+
888
+ pub struct SYSTEM_INFO {
889
+ wProcessorArchitecture : WORD ,
890
+ wReserved : WORD ,
891
+ dwPageSize : DWORD ,
892
+ lpMinimumApplicationAddress : LPVOID ,
893
+ lpMaximumApplicationAddress : LPVOID ,
894
+ dwActiveProcessorMask : DWORD ,
895
+ dwNumberOfProcessors : DWORD ,
896
+ dwProcessorType : DWORD ,
897
+ dwAllocationGranularity : DWORD ,
898
+ wProcessorLevel : WORD ,
899
+ wProcessorRevision : WORD
900
+ }
901
+ pub type LPSYSTEM_INFO = * mut SYSTEM_INFO ;
902
+
903
+ impl SYSTEM_INFO {
904
+ pub fn new ( ) -> SYSTEM_INFO {
905
+ SYSTEM_INFO {
906
+ wProcessorArchitecture : 0 ,
907
+ wReserved : 0 ,
908
+ dwPageSize : 0 ,
909
+ lpMinimumApplicationAddress : ptr:: mut_null ( ) ,
910
+ lpMaximumApplicationAddress : ptr:: mut_null ( ) ,
911
+ dwActiveProcessorMask : 0 ,
912
+ dwNumberOfProcessors : 0 ,
913
+ dwProcessorType : 0 ,
914
+ dwAllocationGranularity : 0 ,
915
+ wProcessorLevel : 0 ,
916
+ wProcessorRevision : 0
917
+ }
918
+ }
919
+ }
920
+
921
+ pub struct MEMORY_BASIC_INFORMATION {
922
+ BaseAddress : LPVOID ,
923
+ AllocationBase : LPVOID ,
924
+ AllocationProtect : DWORD ,
925
+ RegionSize : SIZE_T ,
926
+ State : DWORD ,
927
+ Protect : DWORD ,
928
+ Type : DWORD
929
+ }
930
+ pub type LPMEMORY_BASIC_INFORMATION = * mut MEMORY_BASIC_INFORMATION ;
931
+ }
932
+ }
767
933
}
768
934
769
935
#[ cfg( target_os = "macos" ) ]
@@ -3093,6 +3259,7 @@ pub mod funcs {
3093
3259
LPSYSTEM_INFO } ;
3094
3260
use libc:: types:: os:: arch:: extra:: { HANDLE , LPHANDLE } ;
3095
3261
3262
+ #[ cfg( target_arch = "x86" ) ]
3096
3263
#[ abi = "stdcall" ]
3097
3264
extern "stdcall" {
3098
3265
pub fn GetEnvironmentVariableW ( n : LPCWSTR ,
@@ -3197,6 +3364,111 @@ pub mod funcs {
3197
3364
-> LPVOID ;
3198
3365
pub fn UnmapViewOfFile ( lpBaseAddress : LPCVOID ) -> BOOL ;
3199
3366
}
3367
+
3368
+ #[ cfg( target_arch = "x86_64" ) ]
3369
+ extern {
3370
+ pub fn GetEnvironmentVariableW ( n : LPCWSTR ,
3371
+ v : LPWSTR ,
3372
+ nsize : DWORD )
3373
+ -> DWORD ;
3374
+ pub fn SetEnvironmentVariableW ( n : LPCWSTR , v : LPCWSTR )
3375
+ -> BOOL ;
3376
+ pub fn GetEnvironmentStringsA ( ) -> LPTCH ;
3377
+ pub fn FreeEnvironmentStringsA ( env_ptr : LPTCH ) -> BOOL ;
3378
+ pub fn GetModuleFileNameW ( hModule : HMODULE ,
3379
+ lpFilename : LPWSTR ,
3380
+ nSize : DWORD )
3381
+ -> DWORD ;
3382
+ pub fn CreateDirectoryW ( lpPathName : LPCWSTR ,
3383
+ lpSecurityAttributes :
3384
+ LPSECURITY_ATTRIBUTES )
3385
+ -> BOOL ;
3386
+ pub fn CopyFileW ( lpExistingFileName : LPCWSTR ,
3387
+ lpNewFileName : LPCWSTR ,
3388
+ bFailIfExists : BOOL )
3389
+ -> BOOL ;
3390
+ pub fn DeleteFileW ( lpPathName : LPCWSTR ) -> BOOL ;
3391
+ pub fn RemoveDirectoryW ( lpPathName : LPCWSTR ) -> BOOL ;
3392
+ pub fn SetCurrentDirectoryW ( lpPathName : LPCWSTR ) -> BOOL ;
3393
+ pub fn GetLastError ( ) -> DWORD ;
3394
+ pub fn FindFirstFileW ( fileName : * u16 , findFileData : HANDLE )
3395
+ -> HANDLE ;
3396
+ pub fn FindNextFileW ( findFile : HANDLE , findFileData : HANDLE )
3397
+ -> BOOL ;
3398
+ pub fn FindClose ( findFile : HANDLE ) -> BOOL ;
3399
+ pub fn DuplicateHandle ( hSourceProcessHandle : HANDLE ,
3400
+ hSourceHandle : HANDLE ,
3401
+ hTargetProcessHandle : HANDLE ,
3402
+ lpTargetHandle : LPHANDLE ,
3403
+ dwDesiredAccess : DWORD ,
3404
+ bInheritHandle : BOOL ,
3405
+ dwOptions : DWORD )
3406
+ -> BOOL ;
3407
+ pub fn CloseHandle ( hObject : HANDLE ) -> BOOL ;
3408
+ pub fn OpenProcess ( dwDesiredAccess : DWORD ,
3409
+ bInheritHandle : BOOL ,
3410
+ dwProcessId : DWORD )
3411
+ -> HANDLE ;
3412
+ pub fn GetCurrentProcess ( ) -> HANDLE ;
3413
+ pub fn CreateProcessA ( lpApplicationName : LPCTSTR ,
3414
+ lpCommandLine : LPTSTR ,
3415
+ lpProcessAttributes :
3416
+ LPSECURITY_ATTRIBUTES ,
3417
+ lpThreadAttributes :
3418
+ LPSECURITY_ATTRIBUTES ,
3419
+ bInheritHandles : BOOL ,
3420
+ dwCreationFlags : DWORD ,
3421
+ lpEnvironment : LPVOID ,
3422
+ lpCurrentDirectory : LPCTSTR ,
3423
+ lpStartupInfo : LPSTARTUPINFO ,
3424
+ lpProcessInformation :
3425
+ LPPROCESS_INFORMATION )
3426
+ -> BOOL ;
3427
+ pub fn WaitForSingleObject ( hHandle : HANDLE ,
3428
+ dwMilliseconds : DWORD )
3429
+ -> DWORD ;
3430
+ pub fn TerminateProcess ( hProcess : HANDLE , uExitCode : c_uint )
3431
+ -> BOOL ;
3432
+ pub fn GetExitCodeProcess ( hProcess : HANDLE ,
3433
+ lpExitCode : LPDWORD )
3434
+ -> BOOL ;
3435
+ pub fn GetSystemInfo ( lpSystemInfo : LPSYSTEM_INFO ) ;
3436
+ pub fn VirtualAlloc ( lpAddress : LPVOID ,
3437
+ dwSize : SIZE_T ,
3438
+ flAllocationType : DWORD ,
3439
+ flProtect : DWORD )
3440
+ -> LPVOID ;
3441
+ pub fn VirtualFree ( lpAddress : LPVOID ,
3442
+ dwSize : SIZE_T ,
3443
+ dwFreeType : DWORD )
3444
+ -> BOOL ;
3445
+ pub fn VirtualLock ( lpAddress : LPVOID , dwSize : SIZE_T ) -> BOOL ;
3446
+ pub fn VirtualUnlock ( lpAddress : LPVOID , dwSize : SIZE_T )
3447
+ -> BOOL ;
3448
+ pub fn VirtualProtect ( lpAddress : LPVOID ,
3449
+ dwSize : SIZE_T ,
3450
+ flNewProtect : DWORD ,
3451
+ lpflOldProtect : LPDWORD )
3452
+ -> BOOL ;
3453
+ pub fn VirtualQuery ( lpAddress : LPCVOID ,
3454
+ lpBuffer : LPMEMORY_BASIC_INFORMATION ,
3455
+ dwLength : SIZE_T )
3456
+ -> SIZE_T ;
3457
+ pub fn CreateFileMappingW ( hFile : HANDLE ,
3458
+ lpAttributes : LPSECURITY_ATTRIBUTES ,
3459
+ flProtect : DWORD ,
3460
+ dwMaximumSizeHigh : DWORD ,
3461
+ dwMaximumSizeLow : DWORD ,
3462
+ lpName : LPCTSTR )
3463
+ -> HANDLE ;
3464
+ pub fn MapViewOfFile ( hFileMappingObject : HANDLE ,
3465
+ dwDesiredAccess : DWORD ,
3466
+ dwFileOffsetHigh : DWORD ,
3467
+ dwFileOffsetLow : DWORD ,
3468
+ dwNumberOfBytesToMap : SIZE_T )
3469
+ -> LPVOID ;
3470
+ pub fn UnmapViewOfFile ( lpBaseAddress : LPCVOID ) -> BOOL ;
3471
+ }
3200
3472
}
3201
3473
3202
3474
pub mod msvcrt {
0 commit comments