OLD | NEW |
1 // mksyscall_windows.pl winapi.go | 1 // mksyscall_windows.pl winapi.go |
2 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT | 2 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT |
3 | 3 |
4 package main | 4 package main |
5 | 5 |
6 import "unsafe" | 6 import "unsafe" |
7 import "syscall" | 7 import "syscall" |
8 | 8 |
9 var ( | 9 var ( |
10 modkernel32 = syscall.NewLazyDLL("kernel32.dll") | 10 modkernel32 = syscall.NewLazyDLL("kernel32.dll") |
(...skipping 10 matching lines...) Expand all Loading... |
21 procGetMessageW = moduser32.NewProc("GetMessageW") | 21 procGetMessageW = moduser32.NewProc("GetMessageW") |
22 procTranslateMessage = moduser32.NewProc("TranslateMessage") | 22 procTranslateMessage = moduser32.NewProc("TranslateMessage") |
23 procDispatchMessageW = moduser32.NewProc("DispatchMessageW") | 23 procDispatchMessageW = moduser32.NewProc("DispatchMessageW") |
24 procLoadIconW = moduser32.NewProc("LoadIconW") | 24 procLoadIconW = moduser32.NewProc("LoadIconW") |
25 procLoadCursorW = moduser32.NewProc("LoadCursorW") | 25 procLoadCursorW = moduser32.NewProc("LoadCursorW") |
26 procSetCursor = moduser32.NewProc("SetCursor") | 26 procSetCursor = moduser32.NewProc("SetCursor") |
27 procSendMessageW = moduser32.NewProc("SendMessageW") | 27 procSendMessageW = moduser32.NewProc("SendMessageW") |
28 procPostMessageW = moduser32.NewProc("PostMessageW") | 28 procPostMessageW = moduser32.NewProc("PostMessageW") |
29 ) | 29 ) |
30 | 30 |
31 func GetModuleHandle(modname *uint16) (handle uint32, errno int) { | 31 func GetModuleHandle(modname *uint16) (handle syscall.Handle, errno int) { |
32 r0, _, e1 := syscall.Syscall(procGetModuleHandleW.Addr(), 1, uintptr(uns
afe.Pointer(modname)), 0, 0) | 32 r0, _, e1 := syscall.Syscall(procGetModuleHandleW.Addr(), 1, uintptr(uns
afe.Pointer(modname)), 0, 0) |
33 » handle = uint32(r0) | 33 » handle = syscall.Handle(r0) |
34 if handle == 0 { | 34 if handle == 0 { |
35 if e1 != 0 { | 35 if e1 != 0 { |
36 errno = int(e1) | 36 errno = int(e1) |
37 } else { | 37 } else { |
38 errno = syscall.EINVAL | 38 errno = syscall.EINVAL |
39 } | 39 } |
40 } else { | 40 } else { |
41 errno = 0 | 41 errno = 0 |
42 } | 42 } |
43 return | 43 return |
44 } | 44 } |
45 | 45 |
46 func RegisterClassEx(wndclass *Wndclassex) (atom uint16, errno int) { | 46 func RegisterClassEx(wndclass *Wndclassex) (atom uint16, errno int) { |
47 r0, _, e1 := syscall.Syscall(procRegisterClassExW.Addr(), 1, uintptr(uns
afe.Pointer(wndclass)), 0, 0) | 47 r0, _, e1 := syscall.Syscall(procRegisterClassExW.Addr(), 1, uintptr(uns
afe.Pointer(wndclass)), 0, 0) |
48 atom = uint16(r0) | 48 atom = uint16(r0) |
49 if atom == 0 { | 49 if atom == 0 { |
50 if e1 != 0 { | 50 if e1 != 0 { |
51 errno = int(e1) | 51 errno = int(e1) |
52 } else { | 52 } else { |
53 errno = syscall.EINVAL | 53 errno = syscall.EINVAL |
54 } | 54 } |
55 } else { | 55 } else { |
56 errno = 0 | 56 errno = 0 |
57 } | 57 } |
58 return | 58 return |
59 } | 59 } |
60 | 60 |
61 func CreateWindowEx(exstyle uint32, classname *uint16, windowname *uint16, style
uint32, x int32, y int32, width int32, height int32, wndparent uint32, menu uin
t32, instance uint32, param uintptr) (hwnd uint32, errno int) { | 61 func CreateWindowEx(exstyle uint32, classname *uint16, windowname *uint16, style
uint32, x int32, y int32, width int32, height int32, wndparent syscall.Handle,
menu syscall.Handle, instance syscall.Handle, param uintptr) (hwnd syscall.Handl
e, errno int) { |
62 » r0, _, e1 := syscall.Syscall12(procCreateWindowExW.Addr(), 12, uintptr(e
xstyle), uintptr(unsafe.Pointer(classname)), uintptr(unsafe.Pointer(windowname))
, uintptr(style), uintptr(x), uintptr(y), uintptr(width), uintptr(height), uintp
tr(wndparent), uintptr(menu), uintptr(instance), uintptr(param)) | 62 » r0, _, e1 := syscall.Syscall12(procCreateWindowExW.Addr(), 12, uintptr(e
xstyle), uintptr(unsafe.Pointer(classname)), uintptr(unsafe.Pointer(windowname))
, uintptr(style), uintptr(x), uintptr(y), uintptr(width), uintptr(height), uintp
tr(wndparent), uintptr(menu), uintptr(instance), param) |
63 » hwnd = uint32(r0) | 63 » hwnd = syscall.Handle(r0) |
64 if hwnd == 0 { | 64 if hwnd == 0 { |
65 if e1 != 0 { | 65 if e1 != 0 { |
66 errno = int(e1) | 66 errno = int(e1) |
67 } else { | 67 } else { |
68 errno = syscall.EINVAL | 68 errno = syscall.EINVAL |
69 } | 69 } |
70 } else { | 70 } else { |
71 errno = 0 | 71 errno = 0 |
72 } | 72 } |
73 return | 73 return |
74 } | 74 } |
75 | 75 |
76 func DefWindowProc(hwnd uint32, msg uint32, wparam int32, lparam int32) (lresult
int32) { | 76 func DefWindowProc(hwnd syscall.Handle, msg uint32, wparam uintptr, lparam uintp
tr) (lresult uintptr) { |
77 » r0, _, _ := syscall.Syscall6(procDefWindowProcW.Addr(), 4, uintptr(hwnd)
, uintptr(msg), uintptr(wparam), uintptr(lparam), 0, 0) | 77 » lresult, _, _ = syscall.Syscall6(procDefWindowProcW.Addr(), 4, uintptr(h
wnd), uintptr(msg), wparam, lparam, 0, 0) |
78 » lresult = int32(r0) | |
79 return | 78 return |
80 } | 79 } |
81 | 80 |
82 func DestroyWindow(hwnd uint32) (errno int) { | 81 func DestroyWindow(hwnd syscall.Handle) (errno int) { |
83 r1, _, e1 := syscall.Syscall(procDestroyWindow.Addr(), 1, uintptr(hwnd),
0, 0) | 82 r1, _, e1 := syscall.Syscall(procDestroyWindow.Addr(), 1, uintptr(hwnd),
0, 0) |
84 if int(r1) == 0 { | 83 if int(r1) == 0 { |
85 if e1 != 0 { | 84 if e1 != 0 { |
86 errno = int(e1) | 85 errno = int(e1) |
87 } else { | 86 } else { |
88 errno = syscall.EINVAL | 87 errno = syscall.EINVAL |
89 } | 88 } |
90 } else { | 89 } else { |
91 errno = 0 | 90 errno = 0 |
92 } | 91 } |
93 return | 92 return |
94 } | 93 } |
95 | 94 |
96 func PostQuitMessage(exitcode int32) { | 95 func PostQuitMessage(exitcode int32) { |
97 syscall.Syscall(procPostQuitMessage.Addr(), 1, uintptr(exitcode), 0, 0) | 96 syscall.Syscall(procPostQuitMessage.Addr(), 1, uintptr(exitcode), 0, 0) |
98 return | 97 return |
99 } | 98 } |
100 | 99 |
101 func ShowWindow(hwnd uint32, cmdshow int32) (wasvisible bool) { | 100 func ShowWindow(hwnd syscall.Handle, cmdshow int32) (wasvisible bool) { |
102 r0, _, _ := syscall.Syscall(procShowWindow.Addr(), 2, uintptr(hwnd), uin
tptr(cmdshow), 0) | 101 r0, _, _ := syscall.Syscall(procShowWindow.Addr(), 2, uintptr(hwnd), uin
tptr(cmdshow), 0) |
103 wasvisible = bool(r0 != 0) | 102 wasvisible = bool(r0 != 0) |
104 return | 103 return |
105 } | 104 } |
106 | 105 |
107 func UpdateWindow(hwnd uint32) (errno int) { | 106 func UpdateWindow(hwnd syscall.Handle) (errno int) { |
108 r1, _, e1 := syscall.Syscall(procUpdateWindow.Addr(), 1, uintptr(hwnd),
0, 0) | 107 r1, _, e1 := syscall.Syscall(procUpdateWindow.Addr(), 1, uintptr(hwnd),
0, 0) |
109 if int(r1) == 0 { | 108 if int(r1) == 0 { |
110 if e1 != 0 { | 109 if e1 != 0 { |
111 errno = int(e1) | 110 errno = int(e1) |
112 } else { | 111 } else { |
113 errno = syscall.EINVAL | 112 errno = syscall.EINVAL |
114 } | 113 } |
115 } else { | 114 } else { |
116 errno = 0 | 115 errno = 0 |
117 } | 116 } |
118 return | 117 return |
119 } | 118 } |
120 | 119 |
121 func GetMessage(msg *Msg, hwnd uint32, MsgFilterMin uint32, MsgFilterMax uint32)
(ret int32, errno int) { | 120 func GetMessage(msg *Msg, hwnd syscall.Handle, MsgFilterMin uint32, MsgFilterMax
uint32) (ret int32, errno int) { |
122 r0, _, e1 := syscall.Syscall6(procGetMessageW.Addr(), 4, uintptr(unsafe.
Pointer(msg)), uintptr(hwnd), uintptr(MsgFilterMin), uintptr(MsgFilterMax), 0, 0
) | 121 r0, _, e1 := syscall.Syscall6(procGetMessageW.Addr(), 4, uintptr(unsafe.
Pointer(msg)), uintptr(hwnd), uintptr(MsgFilterMin), uintptr(MsgFilterMax), 0, 0
) |
123 ret = int32(r0) | 122 ret = int32(r0) |
124 if ret == -1 { | 123 if ret == -1 { |
125 if e1 != 0 { | 124 if e1 != 0 { |
126 errno = int(e1) | 125 errno = int(e1) |
127 } else { | 126 } else { |
128 errno = syscall.EINVAL | 127 errno = syscall.EINVAL |
129 } | 128 } |
130 } else { | 129 } else { |
131 errno = 0 | 130 errno = 0 |
132 } | 131 } |
133 return | 132 return |
134 } | 133 } |
135 | 134 |
136 func TranslateMessage(msg *Msg) (done bool) { | 135 func TranslateMessage(msg *Msg) (done bool) { |
137 r0, _, _ := syscall.Syscall(procTranslateMessage.Addr(), 1, uintptr(unsa
fe.Pointer(msg)), 0, 0) | 136 r0, _, _ := syscall.Syscall(procTranslateMessage.Addr(), 1, uintptr(unsa
fe.Pointer(msg)), 0, 0) |
138 done = bool(r0 != 0) | 137 done = bool(r0 != 0) |
139 return | 138 return |
140 } | 139 } |
141 | 140 |
142 func DispatchMessage(msg *Msg) (ret int32) { | 141 func DispatchMessage(msg *Msg) (ret int32) { |
143 r0, _, _ := syscall.Syscall(procDispatchMessageW.Addr(), 1, uintptr(unsa
fe.Pointer(msg)), 0, 0) | 142 r0, _, _ := syscall.Syscall(procDispatchMessageW.Addr(), 1, uintptr(unsa
fe.Pointer(msg)), 0, 0) |
144 ret = int32(r0) | 143 ret = int32(r0) |
145 return | 144 return |
146 } | 145 } |
147 | 146 |
148 func LoadIcon(instance uint32, iconname *uint16) (icon uint32, errno int) { | 147 func LoadIcon(instance syscall.Handle, iconname *uint16) (icon syscall.Handle, e
rrno int) { |
149 r0, _, e1 := syscall.Syscall(procLoadIconW.Addr(), 2, uintptr(instance),
uintptr(unsafe.Pointer(iconname)), 0) | 148 r0, _, e1 := syscall.Syscall(procLoadIconW.Addr(), 2, uintptr(instance),
uintptr(unsafe.Pointer(iconname)), 0) |
150 » icon = uint32(r0) | 149 » icon = syscall.Handle(r0) |
151 if icon == 0 { | 150 if icon == 0 { |
152 if e1 != 0 { | 151 if e1 != 0 { |
153 errno = int(e1) | 152 errno = int(e1) |
154 } else { | 153 } else { |
155 errno = syscall.EINVAL | 154 errno = syscall.EINVAL |
156 } | 155 } |
157 } else { | 156 } else { |
158 errno = 0 | 157 errno = 0 |
159 } | 158 } |
160 return | 159 return |
161 } | 160 } |
162 | 161 |
163 func LoadCursor(instance uint32, cursorname *uint16) (cursor uint32, errno int)
{ | 162 func LoadCursor(instance syscall.Handle, cursorname *uint16) (cursor syscall.Han
dle, errno int) { |
164 r0, _, e1 := syscall.Syscall(procLoadCursorW.Addr(), 2, uintptr(instance
), uintptr(unsafe.Pointer(cursorname)), 0) | 163 r0, _, e1 := syscall.Syscall(procLoadCursorW.Addr(), 2, uintptr(instance
), uintptr(unsafe.Pointer(cursorname)), 0) |
165 » cursor = uint32(r0) | 164 » cursor = syscall.Handle(r0) |
166 if cursor == 0 { | 165 if cursor == 0 { |
167 if e1 != 0 { | 166 if e1 != 0 { |
168 errno = int(e1) | 167 errno = int(e1) |
169 } else { | 168 } else { |
170 errno = syscall.EINVAL | 169 errno = syscall.EINVAL |
171 } | 170 } |
172 } else { | 171 } else { |
173 errno = 0 | 172 errno = 0 |
174 } | 173 } |
175 return | 174 return |
176 } | 175 } |
177 | 176 |
178 func SetCursor(cursor uint32) (precursor uint32, errno int) { | 177 func SetCursor(cursor syscall.Handle) (precursor syscall.Handle, errno int) { |
179 r0, _, e1 := syscall.Syscall(procSetCursor.Addr(), 1, uintptr(cursor), 0
, 0) | 178 r0, _, e1 := syscall.Syscall(procSetCursor.Addr(), 1, uintptr(cursor), 0
, 0) |
180 » precursor = uint32(r0) | 179 » precursor = syscall.Handle(r0) |
181 if precursor == 0 { | 180 if precursor == 0 { |
182 if e1 != 0 { | 181 if e1 != 0 { |
183 errno = int(e1) | 182 errno = int(e1) |
184 } else { | 183 } else { |
185 errno = syscall.EINVAL | 184 errno = syscall.EINVAL |
186 } | 185 } |
187 } else { | 186 } else { |
188 errno = 0 | 187 errno = 0 |
189 } | 188 } |
190 return | 189 return |
191 } | 190 } |
192 | 191 |
193 func SendMessage(hwnd uint32, msg uint32, wparam int32, lparam int32) (lresult i
nt32) { | 192 func SendMessage(hwnd syscall.Handle, msg uint32, wparam uintptr, lparam uintptr
) (lresult uintptr) { |
194 » r0, _, _ := syscall.Syscall6(procSendMessageW.Addr(), 4, uintptr(hwnd),
uintptr(msg), uintptr(wparam), uintptr(lparam), 0, 0) | 193 » lresult, _, _ = syscall.Syscall6(procSendMessageW.Addr(), 4, uintptr(hwn
d), uintptr(msg), wparam, lparam, 0, 0) |
195 » lresult = int32(r0) | |
196 return | 194 return |
197 } | 195 } |
198 | 196 |
199 func PostMessage(hwnd uint32, msg uint32, wparam int32, lparam int32) (errno int
) { | 197 func PostMessage(hwnd syscall.Handle, msg uint32, wparam uintptr, lparam uintptr
) (errno int) { |
200 » r1, _, e1 := syscall.Syscall6(procPostMessageW.Addr(), 4, uintptr(hwnd),
uintptr(msg), uintptr(wparam), uintptr(lparam), 0, 0) | 198 » r1, _, e1 := syscall.Syscall6(procPostMessageW.Addr(), 4, uintptr(hwnd),
uintptr(msg), wparam, lparam, 0, 0) |
201 if int(r1) == 0 { | 199 if int(r1) == 0 { |
202 if e1 != 0 { | 200 if e1 != 0 { |
203 errno = int(e1) | 201 errno = int(e1) |
204 } else { | 202 } else { |
205 errno = syscall.EINVAL | 203 errno = syscall.EINVAL |
206 } | 204 } |
207 } else { | 205 } else { |
208 errno = 0 | 206 errno = 0 |
209 } | 207 } |
210 return | 208 return |
211 } | 209 } |
OLD | NEW |