github.com/as/shiny@v0.8.2/driver/win32/zsyscall_windows.go (about) 1 // Code generated by 'go generate'; DO NOT EDIT. 2 3 package win32 4 5 import ( 6 "syscall" 7 "unsafe" 8 9 "github.com/as/shiny/sys/windows" 10 ) 11 12 var _ unsafe.Pointer 13 14 // Do the interface allocations only once for common 15 // Errno values. 16 const ( 17 errnoERROR_IO_PENDING = 997 18 ) 19 20 var ( 21 errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) 22 ) 23 24 // errnoErr returns common boxed Errno values, to prevent 25 // allocations at runtime. 26 func errnoErr(e syscall.Errno) error { 27 switch e { 28 case 0: 29 return nil 30 case errnoERROR_IO_PENDING: 31 return errERROR_IO_PENDING 32 } 33 // TODO: add more here, after collecting data on the common 34 // error values see on Windows. (perhaps when running 35 // all.bat?) 36 return e 37 } 38 39 var ( 40 modmsimg32 = windows.NewLazySystemDLL("msimg32.dll") 41 modgdi32 = windows.NewLazySystemDLL("gdi32.dll") 42 modkernel32 = windows.NewLazySystemDLL("kernel32.dll") 43 moduser32 = windows.NewLazySystemDLL("user32.dll") 44 45 procAlphaBlend = modmsimg32.NewProc("AlphaBlend") 46 procBitBlt = modgdi32.NewProc("BitBlt") 47 procCreateCompatibleBitmap = modgdi32.NewProc("CreateCompatibleBitmap") 48 procCreateCompatibleDC = modgdi32.NewProc("CreateCompatibleDC") 49 procCreateDIBSection = modgdi32.NewProc("CreateDIBSection") 50 procCreateSolidBrush = modgdi32.NewProc("CreateSolidBrush") 51 procDeleteDC = modgdi32.NewProc("DeleteDC") 52 procDeleteObject = modgdi32.NewProc("DeleteObject") 53 procFillRect = moduser32.NewProc("FillRect") 54 procModifyWorldTransform = modgdi32.NewProc("ModifyWorldTransform") 55 procSelectObject = modgdi32.NewProc("SelectObject") 56 procSetGraphicsMode = modgdi32.NewProc("SetGraphicsMode") 57 procSetWorldTransform = modgdi32.NewProc("SetWorldTransform") 58 procStretchBlt = modgdi32.NewProc("StretchBlt") 59 procGetDeviceCaps = modgdi32.NewProc("GetDeviceCaps") 60 61 procGetConsoleWindow = modkernel32.NewProc("GetConsoleWindow") 62 procGetDC = moduser32.NewProc("GetDC") 63 procReleaseDC = moduser32.NewProc("ReleaseDC") 64 procSendMessageW = moduser32.NewProc("SendMessageW") 65 procCreateWindowExW = moduser32.NewProc("CreateWindowExW") 66 procDefWindowProcW = moduser32.NewProc("DefWindowProcW") 67 procDestroyWindow = moduser32.NewProc("DestroyWindow") 68 procDispatchMessageW = moduser32.NewProc("DispatchMessageW") 69 procGetClientRect = moduser32.NewProc("GetClientRect") 70 procGetWindowRect = moduser32.NewProc("GetWindowRect") 71 procGetKeyboardLayout = moduser32.NewProc("GetKeyboardLayout") 72 procGetKeyboardState = moduser32.NewProc("GetKeyboardState") 73 procGetKeyState = moduser32.NewProc("GetKeyState") 74 procGetMessageW = moduser32.NewProc("GetMessageW") 75 procLoadCursorW = moduser32.NewProc("LoadCursorW") 76 procLoadIconW = moduser32.NewProc("LoadIconW") 77 procMoveWindow = moduser32.NewProc("MoveWindow") 78 procPostMessageW = moduser32.NewProc("PostMessageW") 79 procPostQuitMessage = moduser32.NewProc("PostQuitMessage") 80 procRegisterClassW = moduser32.NewProc("RegisterClassW") 81 procShowWindow = moduser32.NewProc("ShowWindow") 82 procScreenToClient = moduser32.NewProc("ScreenToClient") 83 procToUnicodeEx = moduser32.NewProc("ToUnicodeEx") 84 procTranslateMessage = moduser32.NewProc("TranslateMessage") 85 ) 86 87 func GetConsoleWindow() (h syscall.Handle) { 88 r0, _, _ := syscall.Syscall(procGetConsoleWindow.Addr(), 0, 0, 0, 0) 89 h = syscall.Handle(r0) 90 return 91 } 92 93 func GetDC(hwnd syscall.Handle) (dc syscall.Handle, err error) { 94 r0, _, e1 := syscall.Syscall(procGetDC.Addr(), 1, uintptr(hwnd), 0, 0) 95 dc = syscall.Handle(r0) 96 if dc == 0 { 97 if e1 != 0 { 98 err = errnoErr(e1) 99 } else { 100 err = syscall.EINVAL 101 } 102 } 103 return 104 } 105 106 func ReleaseDC(hwnd syscall.Handle, dc syscall.Handle) (err error) { 107 r1, _, e1 := syscall.Syscall(procReleaseDC.Addr(), 2, uintptr(hwnd), uintptr(dc), 0) 108 if r1 == 0 { 109 if e1 != 0 { 110 err = errnoErr(e1) 111 } else { 112 err = syscall.EINVAL 113 } 114 } 115 return 116 } 117 118 func sendMessage(hwnd syscall.Handle, uMsg uint32, wParam uintptr, lParam uintptr) (lResult uintptr) { 119 r0, _, _ := syscall.Syscall6(procSendMessageW.Addr(), 4, uintptr(hwnd), uintptr(uMsg), uintptr(wParam), uintptr(lParam), 0, 0) 120 lResult = uintptr(r0) 121 return 122 } 123 124 func CreateWindowEx(exstyle uint32, className *uint16, windowText *uint16, style uint32, x int32, y int32, width int32, height int32, parent syscall.Handle, menu syscall.Handle, hInstance syscall.Handle, lpParam uintptr) (hwnd syscall.Handle, err error) { 125 r0, _, e1 := syscall.Syscall12(procCreateWindowExW.Addr(), 12, uintptr(exstyle), uintptr(unsafe.Pointer(className)), uintptr(unsafe.Pointer(windowText)), uintptr(style), uintptr(x), uintptr(y), uintptr(width), uintptr(height), uintptr(parent), uintptr(menu), uintptr(hInstance), uintptr(lpParam)) 126 hwnd = syscall.Handle(r0) 127 if hwnd == 0 { 128 if e1 != 0 { 129 err = errnoErr(e1) 130 } else { 131 err = syscall.EINVAL 132 } 133 } 134 return 135 } 136 137 func DefWindowProc(hwnd syscall.Handle, uMsg uint32, wParam uintptr, lParam uintptr) (lResult uintptr) { 138 r0, _, _ := syscall.Syscall6(procDefWindowProcW.Addr(), 4, uintptr(hwnd), uintptr(uMsg), uintptr(wParam), uintptr(lParam), 0, 0) 139 lResult = uintptr(r0) 140 return 141 } 142 143 func DestroyWindow(hwnd syscall.Handle) (err error) { 144 r1, _, e1 := syscall.Syscall(procDestroyWindow.Addr(), 1, uintptr(hwnd), 0, 0) 145 if r1 == 0 { 146 if e1 != 0 { 147 err = errnoErr(e1) 148 } else { 149 err = syscall.EINVAL 150 } 151 } 152 return 153 } 154 155 func DispatchMessage(msg *Msg) (ret int32) { 156 r0, _, _ := syscall.Syscall(procDispatchMessageW.Addr(), 1, uintptr(unsafe.Pointer(msg)), 0, 0) 157 ret = int32(r0) 158 return 159 } 160 161 func GetMessage(msg *Msg, hwnd syscall.Handle, msgfiltermin uint32, msgfiltermax uint32) (ret int32, err error) { 162 r0, _, e1 := syscall.Syscall6(procGetMessageW.Addr(), 4, uintptr(unsafe.Pointer(msg)), uintptr(hwnd), uintptr(msgfiltermin), uintptr(msgfiltermax), 0, 0) 163 ret = int32(r0) 164 if ret == -1 { 165 if e1 != 0 { 166 err = errnoErr(e1) 167 } else { 168 err = syscall.EINVAL 169 } 170 } 171 return 172 } 173 174 func RegisterClass(wc *WindowClass) (atom uint16, err error) { 175 r0, _, e1 := syscall.Syscall(procRegisterClassW.Addr(), 1, uintptr(unsafe.Pointer(wc)), 0, 0) 176 atom = uint16(r0) 177 if atom == 0 { 178 if e1 != 0 { 179 err = errnoErr(e1) 180 } else { 181 err = syscall.EINVAL 182 } 183 } 184 return 185 } 186 187 func TranslateMessage(msg *Msg) (done bool) { 188 r0, _, _ := syscall.Syscall(procTranslateMessage.Addr(), 1, uintptr(unsafe.Pointer(msg)), 0, 0) 189 done = r0 != 0 190 return 191 } 192 193 func SetGraphicsMode(dc syscall.Handle, mode int32) (oldmode int32, err error) { 194 r0, _, e1 := syscall.Syscall(procSetGraphicsMode.Addr(), 2, uintptr(dc), uintptr(mode), 0) 195 oldmode = int32(r0) 196 if oldmode == 0 { 197 if e1 != 0 { 198 err = error(e1) 199 } else { 200 err = syscall.EINVAL 201 } 202 } 203 return 204 } 205 206 func GetClientRect(hwnd syscall.Handle, rect *Rectangle) (err error) { 207 r1, _, e1 := syscall.Syscall(procGetClientRect.Addr(), 2, uintptr(hwnd), uintptr(unsafe.Pointer(rect)), 0) 208 if r1 == 0 { 209 if e1 != 0 { 210 err = errnoErr(e1) 211 } else { 212 err = syscall.EINVAL 213 } 214 } 215 return 216 } 217 218 func GetWindowRect(hwnd syscall.Handle, rect *Rectangle) (err error) { 219 r1, _, e1 := syscall.Syscall(procGetWindowRect.Addr(), 2, uintptr(hwnd), uintptr(unsafe.Pointer(rect)), 0) 220 if r1 == 0 { 221 if e1 != 0 { 222 err = errnoErr(e1) 223 } else { 224 err = syscall.EINVAL 225 } 226 } 227 return 228 } 229 230 func GetKeyboardLayout(threadID uint32) (locale syscall.Handle) { 231 r0, _, _ := syscall.Syscall(procGetKeyboardLayout.Addr(), 1, uintptr(threadID), 0, 0) 232 locale = syscall.Handle(r0) 233 return 234 } 235 236 func GetKeyboardState(lpKeyState *byte) (err error) { 237 r1, _, e1 := syscall.Syscall(procGetKeyboardState.Addr(), 1, uintptr(unsafe.Pointer(lpKeyState)), 0, 0) 238 if r1 == 0 { 239 if e1 != 0 { 240 err = errnoErr(e1) 241 } else { 242 err = syscall.EINVAL 243 } 244 } 245 return 246 } 247 248 func GetKeyState(virtkey int32) (keystatus int16) { 249 r0, _, _ := syscall.Syscall(procGetKeyState.Addr(), 1, uintptr(virtkey), 0, 0) 250 keystatus = int16(r0) 251 return 252 } 253 254 func LoadCursor(hInstance syscall.Handle, cursorName uintptr) (cursor syscall.Handle, err error) { 255 r0, _, e1 := syscall.Syscall(procLoadCursorW.Addr(), 2, uintptr(hInstance), uintptr(cursorName), 0) 256 cursor = syscall.Handle(r0) 257 if cursor == 0 { 258 if e1 != 0 { 259 err = errnoErr(e1) 260 } else { 261 err = syscall.EINVAL 262 } 263 } 264 return 265 } 266 267 func LoadIcon(hInstance syscall.Handle, iconName uintptr) (icon syscall.Handle, err error) { 268 r0, _, e1 := syscall.Syscall(procLoadIconW.Addr(), 2, uintptr(hInstance), uintptr(iconName), 0) 269 icon = syscall.Handle(r0) 270 if icon == 0 { 271 if e1 != 0 { 272 err = errnoErr(e1) 273 } else { 274 err = syscall.EINVAL 275 } 276 } 277 return 278 } 279 280 func MoveWindow(hwnd syscall.Handle, x int32, y int32, w int32, h int32, repaint bool) (err error) { 281 var _p0 uint32 282 if repaint { 283 _p0 = 1 284 } else { 285 _p0 = 0 286 } 287 r1, _, e1 := syscall.Syscall6(procMoveWindow.Addr(), 6, uintptr(hwnd), uintptr(x), uintptr(y), uintptr(w), uintptr(h), uintptr(_p0)) 288 if r1 == 0 { 289 if e1 != 0 { 290 err = errnoErr(e1) 291 } else { 292 err = syscall.EINVAL 293 } 294 } 295 return 296 } 297 298 func PostMessage(hwnd syscall.Handle, uMsg uint32, wParam uintptr, lParam uintptr) (lResult bool) { 299 r0, _, _ := syscall.Syscall6(procPostMessageW.Addr(), 4, uintptr(hwnd), uintptr(uMsg), uintptr(wParam), uintptr(lParam), 0, 0) 300 lResult = r0 != 0 301 return 302 } 303 304 func PostQuitMessage(exitCode int32) { 305 syscall.Syscall(procPostQuitMessage.Addr(), 1, uintptr(exitCode), 0, 0) 306 return 307 } 308 309 func ShowWindow(hwnd syscall.Handle, cmdshow int32) (wasvisible bool) { 310 r0, _, _ := syscall.Syscall(procShowWindow.Addr(), 2, uintptr(hwnd), uintptr(cmdshow), 0) 311 wasvisible = r0 != 0 312 return 313 } 314 315 func ScreenToClient(hwnd syscall.Handle, lpPoint *Point) (ok bool) { 316 r0, _, _ := syscall.Syscall(procScreenToClient.Addr(), 2, uintptr(hwnd), uintptr(unsafe.Pointer(lpPoint)), 0) 317 ok = r0 != 0 318 return 319 } 320 321 func ToUnicodeEx(wVirtKey uint32, wScanCode uint32, lpKeyState *byte, pwszBuff *uint16, cchBuff int32, wFlags uint32, dwhkl syscall.Handle) (ret int32) { 322 r0, _, _ := syscall.Syscall9(procToUnicodeEx.Addr(), 7, uintptr(wVirtKey), uintptr(wScanCode), uintptr(unsafe.Pointer(lpKeyState)), uintptr(unsafe.Pointer(pwszBuff)), uintptr(cchBuff), uintptr(wFlags), uintptr(dwhkl), 0, 0) 323 ret = int32(r0) 324 return 325 } 326 327 func AlphaBlend(dcdest syscall.Handle, xoriginDest int32, yoriginDest int32, wDest int32, hDest int32, dcsrc syscall.Handle, xoriginSrc int32, yoriginSrc int32, wsrc int32, hsrc int32, ftn uintptr) (err error) { 328 r1, _, e1 := syscall.Syscall12(procAlphaBlend.Addr(), 11, uintptr(dcdest), uintptr(xoriginDest), uintptr(yoriginDest), uintptr(wDest), uintptr(hDest), uintptr(dcsrc), uintptr(xoriginSrc), uintptr(yoriginSrc), uintptr(wsrc), uintptr(hsrc), uintptr(ftn), 0) 329 if r1 == 0 { 330 if e1 != 0 { 331 err = error(e1) 332 } else { 333 err = syscall.EINVAL 334 } 335 } 336 return 337 } 338 339 func BitBlt(dcdest syscall.Handle, xdest int32, ydest int32, width int32, height int32, dcsrc syscall.Handle, xsrc int32, ysrc int32, rop uint32) (err error) { 340 r1, _, e1 := syscall.Syscall9(procBitBlt.Addr(), 9, uintptr(dcdest), uintptr(xdest), uintptr(ydest), uintptr(width), uintptr(height), uintptr(dcsrc), uintptr(xsrc), uintptr(ysrc), uintptr(rop)) 341 if r1 == 0 { 342 if e1 != 0 { 343 err = error(e1) 344 } else { 345 err = syscall.EINVAL 346 } 347 } 348 return 349 } 350 351 func CreateCompatibleBitmap(dc syscall.Handle, width int32, height int32) (bitmap syscall.Handle, err error) { 352 r0, _, e1 := syscall.Syscall(procCreateCompatibleBitmap.Addr(), 3, uintptr(dc), uintptr(width), uintptr(height)) 353 bitmap = syscall.Handle(r0) 354 if bitmap == 0 { 355 if e1 != 0 { 356 err = error(e1) 357 } else { 358 err = syscall.EINVAL 359 } 360 } 361 return 362 } 363 364 func CreateCompatibleDC(dc syscall.Handle) (newdc syscall.Handle, err error) { 365 r0, _, e1 := syscall.Syscall(procCreateCompatibleDC.Addr(), 1, uintptr(dc), 0, 0) 366 newdc = syscall.Handle(r0) 367 if newdc == 0 { 368 if e1 != 0 { 369 err = error(e1) 370 } else { 371 err = syscall.EINVAL 372 } 373 } 374 return 375 } 376 377 func CreateDIBSection(dc syscall.Handle, bmi *BitmapInfo, usage uint32, bits **byte, section syscall.Handle, offset uint32) (bitmap syscall.Handle, err error) { 378 r0, _, e1 := syscall.Syscall6(procCreateDIBSection.Addr(), 6, uintptr(dc), uintptr(unsafe.Pointer(bmi)), uintptr(usage), uintptr(unsafe.Pointer(bits)), uintptr(section), uintptr(offset)) 379 bitmap = syscall.Handle(r0) 380 if bitmap == 0 { 381 if e1 != 0 { 382 err = error(e1) 383 } else { 384 err = syscall.EINVAL 385 } 386 } 387 return 388 } 389 390 func CreateSolidBrush(color ColorRef) (brush syscall.Handle, err error) { 391 r0, _, e1 := syscall.Syscall(procCreateSolidBrush.Addr(), 1, uintptr(color), 0, 0) 392 brush = syscall.Handle(r0) 393 if brush == 0 { 394 if e1 != 0 { 395 err = error(e1) 396 } else { 397 err = syscall.EINVAL 398 } 399 } 400 return 401 } 402 403 func DeleteDC(dc syscall.Handle) (err error) { 404 r1, _, e1 := syscall.Syscall(procDeleteDC.Addr(), 1, uintptr(dc), 0, 0) 405 if r1 == 0 { 406 if e1 != 0 { 407 err = error(e1) 408 } else { 409 err = syscall.EINVAL 410 } 411 } 412 return 413 } 414 415 func DeleteObject(object syscall.Handle) (err error) { 416 r1, _, e1 := syscall.Syscall(procDeleteObject.Addr(), 1, uintptr(object), 0, 0) 417 if r1 == 0 { 418 if e1 != 0 { 419 err = error(e1) 420 } else { 421 err = syscall.EINVAL 422 } 423 } 424 return 425 } 426 427 func FillRect(dc syscall.Handle, rc *Rectangle, brush syscall.Handle) (err error) { 428 r1, _, e1 := syscall.Syscall(procFillRect.Addr(), 3, uintptr(dc), uintptr(unsafe.Pointer(rc)), uintptr(brush)) 429 if r1 == 0 { 430 if e1 != 0 { 431 err = error(e1) 432 } else { 433 err = syscall.EINVAL 434 } 435 } 436 return 437 } 438 439 func ModifyWorldTransform(dc syscall.Handle, x *Xform, mode uint32) (err error) { 440 r1, _, e1 := syscall.Syscall(procModifyWorldTransform.Addr(), 3, uintptr(dc), uintptr(unsafe.Pointer(x)), uintptr(mode)) 441 if r1 == 0 { 442 if e1 != 0 { 443 err = error(e1) 444 } else { 445 err = syscall.EINVAL 446 } 447 } 448 return 449 } 450 451 func SelectObject(dc syscall.Handle, gdiobj syscall.Handle) (newobj syscall.Handle, err error) { 452 r0, _, e1 := syscall.Syscall(procSelectObject.Addr(), 2, uintptr(dc), uintptr(gdiobj), 0) 453 newobj = syscall.Handle(r0) 454 if newobj == 0 { 455 if e1 != 0 { 456 err = error(e1) 457 } else { 458 err = syscall.EINVAL 459 } 460 } 461 return 462 } 463 464 func SetWorldTransform(dc syscall.Handle, x *Xform) (err error) { 465 r1, _, e1 := syscall.Syscall(procSetWorldTransform.Addr(), 2, uintptr(dc), uintptr(unsafe.Pointer(x)), 0) 466 if r1 == 0 { 467 if e1 != 0 { 468 err = error(e1) 469 } else { 470 err = syscall.EINVAL 471 } 472 } 473 return 474 } 475 476 func StretchBlt(dcdest syscall.Handle, xdest int32, ydest int32, wdest int32, hdest int32, dcsrc syscall.Handle, xsrc int32, ysrc int32, wsrc int32, hsrc int32, rop uint32) (err error) { 477 r1, _, e1 := syscall.Syscall12(procStretchBlt.Addr(), 11, uintptr(dcdest), uintptr(xdest), uintptr(ydest), uintptr(wdest), uintptr(hdest), uintptr(dcsrc), uintptr(xsrc), uintptr(ysrc), uintptr(wsrc), uintptr(hsrc), uintptr(rop), 0) 478 if r1 == 0 { 479 if e1 != 0 { 480 err = error(e1) 481 } else { 482 err = syscall.EINVAL 483 } 484 } 485 return 486 } 487 488 func GetDeviceCaps(dc syscall.Handle, index int32) (ret int32) { 489 r0, _, _ := syscall.Syscall(procGetDeviceCaps.Addr(), 2, uintptr(dc), uintptr(index), 0) 490 ret = int32(r0) 491 return 492 }