@@ -1284,15 +1284,15 @@ fun lstrcmpiW(stub SizeOfPointer) SizeOfPointer {
12841284// Win32 Spec: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-lstrcmpw
12851285@dllExport('lstrcmpW')
12861286fun lstrcmpW(lpString1 ConstArrayPointer<ClangWideChar>, lpString2 ConstArrayPointer<ClangWideChar>) Int32 {
1287- tofitaDebugLog("lstrcmpW called with lpString1 %8, lpString2 %8".utf16(),
1288- lpString1 as! UInt64, lpString2 as! UInt64)
1287+ tofitaDebugLog("lstrcmpW called with lpString1 %8, lpString2 %8".utf16(),
1288+ lpString1 as! UInt64, lpString2 as! UInt64)
12891289
1290- if lpString1 == null or lpString2 == null {
1291- tofitaDebugLog("> Null string pointer".utf16())
1292- return if lpString1 == null and lpString2 == null { 0 } else {if lpString1 == null { -1 } else { 1 }}
1293- }
1290+ if lpString1 == null or lpString2 == null {
1291+ tofitaDebugLog("> Null string pointer".utf16())
1292+ return if lpString1 == null and lpString2 == null { 0 } else { if lpString1 == null { -1 } else { 1 } }
1293+ }
12941294
1295- var i = 0
1295+ var i = 0
12961296 // TODO Hexa: `ClangWideChar.nullTerminator`
12971297 while lpString1[i] != 0 as! ClangWideChar or lpString2[i] != 0 as! ClangWideChar {
12981298 if (lpString1[i] as! UInt16) < (lpString2[i] as! UInt16) {
@@ -1305,8 +1305,8 @@ fun lstrcmpW(lpString1 ConstArrayPointer<ClangWideChar>, lpString2 ConstArrayPoi
13051305 i += 1
13061306 }
13071307
1308- tofitaDebugLog("> Strings equal".utf16())
1309- return 0
1308+ tofitaDebugLog("> Strings equal".utf16())
1309+ return 0
13101310}
13111311
13121312// TODO reported as unresolved (could be x32 underscore problem) (try @linkName + @rename)
@@ -1791,20 +1791,20 @@ fun maskBlt(stub SizeOfPointer) SizeOfPointer {
17911791// Win32 Spec: https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-getcurrentpositionex
17921792@dllExport('GetCurrentPositionEx')
17931793fun getCurrentPositionEx(hdc HDc, lppt Point) Bool32 {
1794- tofitaDebugLog("GetCurrentPositionEx called with hdc %8, lppt %8".utf16(),
1795- hdc as! UInt64, lppt as! UInt64)
1794+ tofitaDebugLog("GetCurrentPositionEx called with hdc %8, lppt %8".utf16(),
1795+ hdc as! UInt64, lppt as! UInt64)
17961796
1797- let dc = hdc as! DC
1798- if dc == null or lppt == null {
1799- tofitaDebugLog("> Invalid DC or point pointer".utf16())
1800- return Bool32.False
1801- }
1802-
1803- lppt.x = dc.penPosX
1804- lppt.y = dc.penPosY
1805- tofitaDebugLog("> Current position: x %d, y %d".utf16(),
1806- dc.penPosX as! UInt64, dc.penPosY as! UInt64)
1807- return Bool32.True
1797+ let dc = hdc as! DC
1798+ if dc == null or lppt == null {
1799+ tofitaDebugLog("> Invalid DC or point pointer".utf16())
1800+ return Bool32.False
1801+ }
1802+
1803+ lppt.x = dc.penPosX
1804+ lppt.y = dc.penPosY
1805+ tofitaDebugLog("> Current position: x %d, y %d".utf16(),
1806+ dc.penPosX as! UInt64, dc.penPosY as! UInt64)
1807+ return Bool32.True
18081808}
18091809
18101810// Purpose: Updates the current position in a device context
@@ -4056,6 +4056,8 @@ fun setBrushOrgEx(hdc HDc, x Int32, y Int32, lppt Point?) Bool32 {
40564056 return Bool32.True
40574057}
40584058
4059+ // Purpose: Sets the text color for a device context
4060+ // Win32 Spec: https://learn.microsoft.com/en-us/windows/win32/api/wingdi/nf-wingdi-settextcolor
40594061@dllExport('SetTextColor')
40604062fun setTextColor(hdc HDc, color COLORREF) COLORREF {
40614063 tofitaDebugLog("SetTextColor called with hdc %8 color %u".utf16(), hdc as! UInt64, color as! UInt64)
@@ -4247,11 +4249,26 @@ fun initCommonControlsEx(stub SizeOfPointer) SizeOfPointer {
42474249 return 0
42484250}
42494251
4252+ // Win32 Spec: https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-copyrect
42504253@dllExport('CopyRect')
4251- fun copyRect(stub SizeOfPointer) SizeOfPointer {
4252- // TODO
4253- tofitaDebugLog("CopyRect called".utf16())
4254- return 0
4254+ fun copyRect(lprcDst Rect, lprcSrc Rect) Bool32 {
4255+ tofitaDebugLog("CopyRect called with lprcDst %8 lprcSrc %8".utf16(), lprcDst as! UInt64, lprcSrc as! UInt64)
4256+
4257+ if lprcDst == null or lprcSrc == null {
4258+ tofitaDebugLog("> Invalid rectangle pointer".utf16())
4259+ return Bool32.False
4260+ }
4261+
4262+ lprcDst.left = lprcSrc.left
4263+ lprcDst.top = lprcSrc.top
4264+ lprcDst.right = lprcSrc.right
4265+ lprcDst.bottom = lprcSrc.bottom
4266+
4267+ tofitaDebugLog("> Copied rect: left %d, top %d".utf16(),
4268+ lprcDst.left as! UInt64, lprcDst.top as! UInt64)
4269+ tofitaDebugLog("> right %d, bottom %d".utf16(),
4270+ lprcDst.right as! UInt64, lprcDst.bottom as! UInt64)
4271+ return Bool32.True
42554272}
42564273
42574274@dllExport('SetWindowLongPtrA')
0 commit comments