1 /* 2 mkwinsyscall generates windows system call bodies 3 4 It parses all files specified on command line containing function 5 prototypes (like syscall_windows.go) and prints system call bodies 6 to standard output. 7 8 The prototypes are marked by lines beginning with "//sys" and read 9 like func declarations if //sys is replaced by func, but: 10 11 - The parameter lists must give a name for each argument. This 12 includes return parameters. 13 14 - The parameter lists must give a type for each argument: 15 the (x, y, z int) shorthand is not allowed. 16 17 - If the return parameter is an error number, it must be named err. 18 19 - If go func name needs to be different from its winapi dll name, 20 the winapi name could be specified at the end, after "=" sign, like 21 22 //sys LoadLibrary(libname string) (handle uint32, err error) = LoadLibraryA 23 24 - Each function that returns err needs to supply a condition, that 25 return value of winapi will be tested against to detect failure. 26 This would set err to windows "last-error", otherwise it will be nil. 27 The value can be provided at end of //sys declaration, like 28 29 //sys LoadLibrary(libname string) (handle uint32, err error) [failretval==-1] = LoadLibraryA 30 31 and is [failretval==0] by default. 32 33 - If the function name ends in a "?", then the function not existing is non- 34 fatal, and an error will be returned instead of panicking. 35 36 Usage: 37 38 mkwinsyscall [flags] [path ...] 39 40 Flags 41 42 -output string 43 Output file name (standard output if omitted). 44 -sort 45 Sort DLL and function declarations (default true). 46 Intended to help transition from older versions of mkwinsyscall by making diffs 47 easier to read and understand. 48 -systemdll 49 Whether all DLLs should be loaded from the Windows system directory (default true). 50 -trace 51 Generate print statement after every syscall. 52 -utf16 53 Encode string arguments as UTF-16 for syscalls not ending in 'A' or 'W' (default true). 54 -winio 55 Import this package ("github.com/Microsoft/go-winio"). 56 */ 57 package main 58