Skip to content

Commit 5f362d3

Browse files
committed
[CRT] lstrlenA
1 parent 1798740 commit 5f362d3

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

dlls/user32/extras.hexa

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4366,11 +4366,23 @@ fun getVersion(stub SizeOfPointer) SizeOfPointer {
43664366
// return 0x80000000u32 // Windows 98
43674367
}
43684368

4369+
// Win32 Spec: https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-lstrlena
43694370
@dllExport('lstrlenA')
4370-
fun lstrlenA(stub SizeOfPointer) SizeOfPointer {
4371-
// TODO
4372-
tofitaDebugLog("lstrlenA called".utf16())
4373-
return 0
4371+
fun lstrlenA(lpString ConstArrayPointer<ClangChar>) Int32 {
4372+
tofitaDebugLog("lstrlenA called with lpString %8".utf16(), lpString as! UInt64)
4373+
4374+
if lpString == null {
4375+
tofitaDebugLog("> Null string pointer".utf16())
4376+
return 0
4377+
}
4378+
4379+
var length = 0
4380+
while lpString[length] != 0 as! ClangChar {
4381+
length += 1
4382+
}
4383+
4384+
tofitaDebugLog("> String length %d".utf16(), length as! UInt64)
4385+
return length
43744386
}
43754387

43764388
@dllExport('ReleaseMutex')

0 commit comments

Comments
 (0)