Skip to content

Commit

Permalink
[DLL] Stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
PeyTy committed May 26, 2024
1 parent d37f94d commit c2ce0b0
Show file tree
Hide file tree
Showing 3 changed files with 660 additions and 3 deletions.
208 changes: 208 additions & 0 deletions dlls/kernel32.dll/kernel32.hexa
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,213 @@ fun free(@hide pointer SizeOfPointer) Void {
// Note: pointer may be null
}

@dllExport('DeleteCriticalSection')
fun deleteCriticalSection(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("deleteCriticalSection()\n".utf16())
return 0
}

@dllExport('EnterCriticalSection')
fun enterCriticalSection(stub SizeOfPointer) SizeOfPointer {
// TODO
// TODO Hexa: code gen into just L"string"
// ^ and NOT count for .c String.new() generation
tofitaDebugLog("enterCriticalSection()\n".utf16())
return 0
}

@dllExport('FreeLibrary')
fun freeLibrary(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("freeLibrary()\n".utf16())
return 0
}

@dllExport('GetCurrentProcess')
fun getCurrentProcess(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getCurrentProcess()\n".utf16())
return 0
}

@dllExport('GetCurrentProcessId')
fun getCurrentProcessId(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getCurrentProcessId()\n".utf16())
return 0
}

@dllExport('GetCurrentThreadId')
fun getCurrentThreadId(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getCurrentThreadId()\n".utf16())
return 0
}

@dllExport('GetLastError')
fun getLastError(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getLastError()\n".utf16())
return 0
}

@dllExport('GetLocaleInfoW')
fun getLocaleInfoW(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getLocaleInfoW()\n".utf16())
return 0
}

@dllExport('GetModuleHandleA')
fun getModuleHandleA(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getModuleHandleA()\n".utf16())
return 0
}

@dllExport('GetProcAddress')
fun getProcAddress(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getProcAddress()\n".utf16())
return 0
}

@dllExport('GetProfileIntW')
fun getProfileIntW(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getProfileIntW()\n".utf16())
return 0
}

@dllExport('GetStartupInfoW')
fun getStartupInfoW(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getStartupInfoW()\n".utf16())
return 0
}

@dllExport('GetSystemTimeAsFileTime')
fun getSystemTimeAsFileTime(stub SizeOfPointer) SizeOfPointer {
// TODO
let str ArrayByValue<UInt16, 5> = "bruh"
// TODO Hexa: String inlining bug where str expected `value && type==String`
// TODO Hexa: .ref bug
tofitaDebugLog(str as! ConstArrayPointer<ClangWideChar>)
tofitaDebugLog("getSystemTimeAsFileTime()\n" as! ConstArrayPointer<ClangWideChar>)
tofitaDebugLog("getSystemTimeAsFileTime()\n".utf16())
return 0
}

@dllExport('GetTickCount')
fun getTickCount(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getTickCount()\n".utf16())
return 0
}
@dllExport('GetVersionExW')
fun getVersionExW(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("getVersionExW()\n".utf16())
return 0
}

@dllExport('GlobalLock')
fun globalLock(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("globalLock()\n".utf16())
return 0
}

@dllExport('GlobalUnlock')
fun globalUnlock(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("globalUnlock()\n".utf16())
return 0
}

@dllExport('InitializeCriticalSection')
fun initializeCriticalSection(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("initializeCriticalSection()\n".utf16())
return 0
}

@dllExport('LeaveCriticalSection')
fun leaveCriticalSection(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("leaveCriticalSection()\n".utf16())
return 0
}

@dllExport('LoadLibraryW')
fun loadLibraryW(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("loadLibraryW()\n".utf16())
return 0
}

@dllExport('QueryPerformanceCounter')
fun queryPerformanceCounter(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("queryPerformanceCounter()\n".utf16())
return 0
}

@dllExport('SetUnhandledExceptionFilter')
fun setUnhandledExceptionFilter(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("setUnhandledExceptionFilter()\n".utf16())
return 0
}
@dllExport('Sleep')
fun sleep(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("sleep()\n".utf16())
return 0
}

@dllExport('TerminateProcess')
fun terminateProcess(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("terminateProcess()\n".utf16())
return 0
}

@dllExport('TlsGetValue')
fun tlsGetValue(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("tlsGetValue()\n".utf16())
return 0
}

@dllExport('UnhandledExceptionFilter')
fun unhandledExceptionFilter(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("unhandledExceptionFilter()\n".utf16())
return 0
}

@dllExport('VirtualProtect')
fun virtualProtect(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("virtualProtect()\n".utf16())
return 0
}

@dllExport('VirtualQuery')
fun virtualQuery(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("virtualQuery()\n".utf16())
return 0
}

@dllExport('WriteProfileStringW')
fun writeProfileStringW(stub SizeOfPointer) SizeOfPointer {
// TODO
tofitaDebugLog("writeProfileStringW()\n".utf16())
return 0
}

// TODO @linkName('_DllMainCRTStartup')
@fastcall fun _DllMainCRTStartup() Void {}
Loading

0 comments on commit c2ce0b0

Please sign in to comment.