From efea2951f8ca2f939ea9297ea4a035e7e99ef714 Mon Sep 17 00:00:00 2001 From: notaz Date: Thu, 13 Feb 2014 04:45:57 +0200 Subject: [PATCH] yet more stuff for storm --- tools/cvt_data.c | 5 +- tools/protoparse.h | 7 ++- tools/translate.c | 10 ++- win32.hlist | 150 ++++++++++++++++++++++++++++----------------- 4 files changed, 113 insertions(+), 59 deletions(-) diff --git a/tools/cvt_data.c b/tools/cvt_data.c index 2f32181..7138da0 100644 --- a/tools/cvt_data.c +++ b/tools/cvt_data.c @@ -517,7 +517,10 @@ int main(int argc, char *argv[]) fprintf(fout, "\t\t "); } - if (type == DXT_BYTE && words[w][0] == '\'') { + if (type == DXT_BYTE + && (words[w][0] == '\'' + || (w + 1 < wordc && words[w + 1][0] == '\''))) + { // string; use asciz for most common case if (w == wordc - 2 && IS(words[w + 1], "0")) { fprintf(fout, ".asciz \""); diff --git a/tools/protoparse.h b/tools/protoparse.h index 0900243..9a126cc 100644 --- a/tools/protoparse.h +++ b/tools/protoparse.h @@ -28,10 +28,11 @@ struct parsed_proto { unsigned int is_func:1; unsigned int is_stdcall:1; unsigned int is_fastcall:1; - unsigned int is_vararg:1; + unsigned int is_vararg:1; // vararg func unsigned int is_fptr:1; unsigned int is_noreturn:1; unsigned int is_unresolved:1; + unsigned int is_arg:1; // decl in func arg unsigned int has_structarg:1; }; @@ -512,6 +513,10 @@ static int parse_protostr(char *protostr, struct parsed_proto *pp) hdrfn, hdrfline, p1 - protostr); return -1; } + arg->fptr->is_arg = 1; + // we don't use actual names right now.. + snprintf(arg->fptr->name, + sizeof(arg->fptr->name), "a%d", xarg); // we'll treat it as void * for non-calls arg->type.name = strdup("void *"); arg->type.is_ptr = 1; diff --git a/tools/translate.c b/tools/translate.c index 7493761..f5674ca 100644 --- a/tools/translate.c +++ b/tools/translate.c @@ -2857,6 +2857,11 @@ static void gen_func(FILE *fout, FILE *fhdr, const char *funcn, int opcnt) ferr(ops, "nested fptr\n"); fprintf(fout, "%s", pp->arg[j].type.name); } + if (pp->is_vararg) { + if (j > 0) + fprintf(fout, ", "); + fprintf(fout, "..."); + } fprintf(fout, ")"); } else { @@ -3428,7 +3433,8 @@ tailcall: } } - if (pp->is_fptr) { + // declare indirect funcs + if (pp->is_fptr && !(pp->name[0] != 0 && pp->is_arg)) { if (pp->name[0] != 0) { memmove(pp->name + 2, pp->name, strlen(pp->name) + 1); memcpy(pp->name, "i_", 2); @@ -4208,7 +4214,7 @@ tailcall: pp = po->datap; my_assert_not(pp, NULL); - if (pp->is_fptr) + if (pp->is_fptr && !pp->is_arg) fprintf(fout, " %s = %s;\n", pp->name, out_src_opr(buf1, sizeof(buf1), po, &po->operand[0], "(void *)", 0)); diff --git a/win32.hlist b/win32.hlist index 6556715..826e4ac 100644 --- a/win32.hlist +++ b/win32.hlist @@ -457,13 +457,28 @@ WINBASEAPI BOOL WINAPI SetVolumeLabelW(LPCWSTR,LPCWSTR); WINBASEAPI BOOL WINAPI SetVolumeMountPointA(LPCSTR,LPCSTR); WINBASEAPI BOOL WINAPI SetVolumeMountPointW(LPCWSTR,LPCWSTR); WINBASEAPI BOOL WINAPI SetWaitableTimer(HANDLE,const LARGE_INTEGER*,LONG,PTIMERAPCROUTINE,PVOID,BOOL); +WINBASEAPI DWORD WINAPI SignalObjectAndWait(HANDLE,HANDLE,DWORD,BOOL); +WINBASEAPI DWORD WINAPI SizeofResource(HINSTANCE,HRSRC); +WINBASEAPI void WINAPI Sleep(DWORD); +WINBASEAPI DWORD WINAPI SleepEx(DWORD,BOOL); +WINBASEAPI DWORD WINAPI SuspendThread(HANDLE); +WINBASEAPI void WINAPI SwitchToFiber(PVOID); +WINBASEAPI BOOL WINAPI SwitchToThread(void); +WINBASEAPI BOOL WINAPI SystemTimeToFileTime(const SYSTEMTIME*,LPFILETIME); +WINBASEAPI BOOL WINAPI SystemTimeToTzSpecificLocalTime(LPTIME_ZONE_INFORMATION,LPSYSTEMTIME,LPSYSTEMTIME); WINBASEAPI BOOL WINAPI TerminateProcess(HANDLE,UINT); +WINBASEAPI BOOL WINAPI TerminateThread(HANDLE,DWORD); +WINBASEAPI DWORD WINAPI TlsAlloc(VOID); WINBASEAPI BOOL WINAPI TlsFree(DWORD); +WINBASEAPI PVOID WINAPI TlsGetValue(DWORD); WINBASEAPI BOOL WINAPI TlsSetValue(DWORD,PVOID); +WINBASEAPI BOOL WINAPI TransactNamedPipe(HANDLE,PVOID,DWORD,PVOID,DWORD,PDWORD,LPOVERLAPPED); +WINBASEAPI BOOL WINAPI TransmitCommChar(HANDLE,char); WINBASEAPI BOOL WINAPI TryEnterCriticalSection(LPCRITICAL_SECTION); WINBASEAPI LONG WINAPI UnhandledExceptionFilter(LPEXCEPTION_POINTERS); WINBASEAPI BOOL WINAPI UnlockFile(HANDLE,DWORD,DWORD,DWORD,DWORD); WINBASEAPI BOOL WINAPI UnlockFileEx(HANDLE,DWORD,DWORD,DWORD,LPOVERLAPPED); + WINBASEAPI BOOL WINAPI UnmapViewOfFile(PVOID); WINBASEAPI BOOL WINAPI UnregisterWait(HANDLE); WINBASEAPI BOOL WINAPI UnregisterWaitEx(HANDLE,HANDLE); @@ -473,75 +488,52 @@ WINBASEAPI BOOL WINAPI VerifyVersionInfoA(LPOSVERSIONINFOEXA,DWORD,DWORDLONG); WINBASEAPI BOOL WINAPI VerifyVersionInfoW(LPOSVERSIONINFOEXW,DWORD,DWORDLONG); WINBASEAPI PVOID WINAPI VirtualAlloc(PVOID,DWORD,DWORD,DWORD); WINBASEAPI PVOID WINAPI VirtualAllocEx(HANDLE,PVOID,DWORD,DWORD,DWORD); -WINBASEAPI BOOL WINAPI VirtualFreeEx(HANDLE,PVOID,DWORD,DWORD); WINBASEAPI BOOL WINAPI VirtualFree(PVOID,DWORD,DWORD); -WINBASEAPI BOOL WINAPI VirtualProtectEx(HANDLE,PVOID,DWORD,DWORD,PDWORD); +WINBASEAPI BOOL WINAPI VirtualFreeEx(HANDLE,PVOID,DWORD,DWORD); +WINBASEAPI BOOL WINAPI VirtualLock(PVOID,DWORD); WINBASEAPI BOOL WINAPI VirtualProtect(PVOID,DWORD,DWORD,PDWORD); -WINBASEAPI BOOL WINAPI WriteFileEx(HANDLE,PCVOID,DWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTINE); -WINBASEAPI BOOL WINAPI WriteFileGather(HANDLE,FILE_SEGMENT_ELEMENT*,DWORD,LPDWORD,LPOVERLAPPED); -WINBASEAPI BOOL WINAPI WriteFile(HANDLE,PCVOID,DWORD,PDWORD,LPOVERLAPPED); -WINBASEAPI DWORD WINAPI HeapSize(HANDLE,DWORD,PCVOID); -WINBASEAPI DWORD WINAPI SetFilePointer(HANDLE,LONG,PLONG,DWORD); -WINBASEAPI DWORD WINAPI SizeofResource(HINSTANCE,HRSRC); -WINBASEAPI DWORD WINAPI SleepEx(DWORD,BOOL); -WINBASEAPI DWORD WINAPI TlsAlloc(VOID); -WINBASEAPI DWORD WINAPI VirtualQueryEx(HANDLE,LPCVOID,PMEMORY_BASIC_INFORMATION,DWORD); +WINBASEAPI BOOL WINAPI VirtualProtectEx(HANDLE,PVOID,DWORD,DWORD,PDWORD); WINBASEAPI DWORD WINAPI VirtualQuery(LPCVOID,PMEMORY_BASIC_INFORMATION,DWORD); +WINBASEAPI DWORD WINAPI VirtualQueryEx(HANDLE,LPCVOID,PMEMORY_BASIC_INFORMATION,DWORD); +WINBASEAPI BOOL WINAPI VirtualUnlock(PVOID,DWORD); +WINBASEAPI BOOL WINAPI WaitCommEvent(HANDLE,PDWORD,LPOVERLAPPED); +WINBASEAPI BOOL WINAPI WaitForDebugEvent(LPDEBUG_EVENT,DWORD); WINBASEAPI DWORD WINAPI WaitForMultipleObjects(DWORD,const HANDLE*,BOOL,DWORD); WINBASEAPI DWORD WINAPI WaitForMultipleObjectsEx(DWORD,const HANDLE*,BOOL,DWORD,BOOL); -WINBASEAPI DWORD WINAPI WaitForSingleObjectEx(HANDLE,DWORD,BOOL); WINBASEAPI DWORD WINAPI WaitForSingleObject(HANDLE,DWORD); -WINBASEAPI FARPROC WINAPI GetProcAddress(HINSTANCE,LPCSTR); -WINBASEAPI HANDLE WINAPI CreateEventA(LPSECURITY_ATTRIBUTES,BOOL,BOOL,LPCSTR); -WINBASEAPI HANDLE WINAPI CreateFileA(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE); -WINBASEAPI HANDLE WINAPI CreateThread(LPSECURITY_ATTRIBUTES,DWORD,LPTHREAD_START_ROUTINE,PVOID,DWORD,PDWORD); -WINBASEAPI HANDLE WINAPI FindFirstFileA(LPCSTR,LPWIN32_FIND_DATAA); -WINBASEAPI HANDLE WINAPI GetCurrentProcess(void); -WINBASEAPI HANDLE WINAPI GetStdHandle(DWORD); +WINBASEAPI DWORD WINAPI WaitForSingleObjectEx(HANDLE,DWORD,BOOL); +WINBASEAPI BOOL WINAPI WaitNamedPipeA(LPCSTR,DWORD); +WINBASEAPI BOOL WINAPI WaitNamedPipeW(LPCWSTR,DWORD); +WINBASEAPI BOOL WINAPI WinLoadTrustProvider(GUID*); +WINBASEAPI BOOL WINAPI WriteFile(HANDLE,PCVOID,DWORD,PDWORD,LPOVERLAPPED); +WINBASEAPI BOOL WINAPI WriteFileEx(HANDLE,PCVOID,DWORD,LPOVERLAPPED,LPOVERLAPPED_COMPLETION_ROUTINE); +WINBASEAPI BOOL WINAPI WriteFileGather(HANDLE,FILE_SEGMENT_ELEMENT*,DWORD,LPDWORD,LPOVERLAPPED); +WINBASEAPI BOOL WINAPI WritePrivateProfileSectionA(LPCSTR,LPCSTR,LPCSTR); +WINBASEAPI BOOL WINAPI WritePrivateProfileSectionW(LPCWSTR,LPCWSTR,LPCWSTR); +WINBASEAPI BOOL WINAPI WritePrivateProfileStringA(LPCSTR,LPCSTR,LPCSTR,LPCSTR); +WINBASEAPI BOOL WINAPI WritePrivateProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR); +WINBASEAPI BOOL WINAPI WritePrivateProfileStructA(LPCSTR,LPCSTR,LPVOID,UINT,LPCSTR); +WINBASEAPI BOOL WINAPI WritePrivateProfileStructW(LPCWSTR,LPCWSTR,LPVOID,UINT,LPCWSTR); +WINBASEAPI BOOL WINAPI WriteProcessMemory(HANDLE,LPVOID,LPCVOID,SIZE_T,SIZE_T*); +WINBASEAPI BOOL WINAPI WriteProfileSectionA(LPCSTR,LPCSTR); +WINBASEAPI BOOL WINAPI WriteProfileSectionW(LPCWSTR,LPCWSTR); +WINBASEAPI BOOL WINAPI WriteProfileStringA(LPCSTR,LPCSTR,LPCSTR); +WINBASEAPI BOOL WINAPI WriteProfileStringW(LPCWSTR,LPCWSTR,LPCWSTR); +WINBASEAPI DWORD WINAPI WriteTapemark(HANDLE,DWORD,DWORD,BOOL); +WINBASEAPI BOOL WINAPI ZombifyActCtx(HANDLE); +WINBASEAPI BOOL WINAPI AllocateUserPhysicalPages(HANDLE,PULONG_PTR,PULONG_PTR); +WINBASEAPI BOOL WINAPI FreeUserPhysicalPages(HANDLE,PULONG_PTR,PULONG_PTR); +WINBASEAPI BOOL WINAPI MapUserPhysicalPages(PVOID,ULONG_PTR,PULONG_PTR); +WINBASEAPI BOOL WINAPI MapUserPhysicalPagesScatter(PVOID*,ULONG_PTR,PULONG_PTR); +WINBASEAPI DWORD WINAPI HeapSize(HANDLE,DWORD,PCVOID); WINBASEAPI HANDLE WINAPI HeapCreate(DWORD,DWORD,DWORD); -WINBASEAPI HANDLE WINAPI RegisterWaitForSingleObjectEx(HANDLE,WAITORTIMERCALLBACK,PVOID,ULONG,ULONG); -WINBASEAPI HGLOBAL WINAPI LoadResource(HINSTANCE,HRSRC); -WINBASEAPI HINSTANCE WINAPI LoadLibraryA(LPCSTR); -WINBASEAPI HMODULE WINAPI GetModuleHandleA(LPCSTR); -WINBASEAPI HRSRC WINAPI FindResourceA(HMODULE,LPCSTR,LPCSTR); -WINBASEAPI int WINAPI MulDiv(int,int,int); -WINBASEAPI LONG WINAPI CompareFileTime(CONST FILETIME*,CONST FILETIME*); -WINBASEAPI LONG WINAPI UnhandledExceptionFilter(LPEXCEPTION_POINTERS); -WINBASEAPI LPSTR WINAPI GetCommandLineA(VOID); -WINBASEAPI LPSTR WINAPI GetEnvironmentStringsA(void); -WINBASEAPI LPSTR WINAPI GetEnvironmentStrings(void); -WINBASEAPI LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER); -WINBASEAPI LPTOP_LEVEL_EXCEPTION_FILTER WINAPI SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER); -WINBASEAPI LPWSTR WINAPI GetEnvironmentStringsW(void); -WINBASEAPI LPWSTR WINAPI GetEnvironmentStringsW(void); WINBASEAPI PVOID WINAPI HeapAlloc(HANDLE,DWORD,DWORD); WINBASEAPI PVOID WINAPI HeapReAlloc(HANDLE,DWORD,PVOID,DWORD); -WINBASEAPI PVOID WINAPI LockResource(HGLOBAL); -WINBASEAPI PVOID WINAPI TlsGetValue(DWORD); -WINBASEAPI UINT WINAPI GetDriveTypeA(LPCSTR); -WINBASEAPI UINT WINAPI GetWindowsDirectoryA(LPSTR,UINT); -WINBASEAPI UINT WINAPI GetWindowsDirectoryW(LPWSTR,UINT); -WINBASEAPI UINT WINAPI SetHandleCount(UINT); -WINBASEAPI void WINAPI DeleteCriticalSection(PCRITICAL_SECTION); -WINBASEAPI void WINAPI EnterCriticalSection(LPCRITICAL_SECTION); -WINBASEAPI void WINAPI GetLocalTime(LPSYSTEMTIME); -WINBASEAPI VOID WINAPI GetStartupInfoA(LPSTARTUPINFOA); -WINBASEAPI VOID WINAPI GetSystemInfo(LPSYSTEM_INFO); -WINBASEAPI void WINAPI GetSystemTimeAsFileTime(LPFILETIME); -WINBASEAPI VOID WINAPI GlobalMemoryStatus(LPMEMORYSTATUS); WINBASEAPI VOID WINAPI InitializeCriticalSection(LPCRITICAL_SECTION); WINBASEAPI void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION); -WINBASEAPI void WINAPI RaiseException(DWORD,DWORD,DWORD,const DWORD*); -WINBASEAPI void WINAPI SetLastError(DWORD); -WINBASEAPI void WINAPI SetLastErrorEx(DWORD,DWORD); -WINBASEAPI void WINAPI Sleep(DWORD); WINGDIAPI BOOL WINAPI ExtTextOutA(HDC,int,int,UINT,LPCRECT,LPCSTR,UINT,const INT*); WINGDIAPI BOOL WINAPI ExtTextOutA(HDC,int,int,UINT,LPCRECT,LPCSTR,UINT,const INT*); -WINGDIAPI BOOL WINAPI GetTextExtentPoint32A(HDC,LPCSTR,int,LPSIZE); -WINGDIAPI BOOL WINAPI SetRectRgn(HRGN,int,int,int,int); WINGDIAPI BOOL WINAPI TextOutA(HDC,int,int,LPCSTR,int); -WINGDIAPI COLORREF WINAPI SetBkColor(HDC,COLORREF); -WINGDIAPI COLORREF WINAPI SetTextColor(HDC,COLORREF); WINGDIAPI HGDIOBJ WINAPI SelectObject(HDC,HGDIOBJ); WINGDIAPI HPALETTE WINAPI SelectPalette(HDC,HPALETTE,BOOL); WINGDIAPI int WINAPI SetAbortProc(HDC,ABORTPROC); @@ -1503,5 +1495,53 @@ WINADVAPI LONG WINAPI RegSetValueW(HKEY,LPCWSTR,DWORD,LPCWSTR,DWORD); WINADVAPI LONG WINAPI RegUnLoadKeyA(HKEY,LPCSTR); WINADVAPI LONG WINAPI RegUnLoadKeyW(HKEY,LPCWSTR); +// commdlg.h +BOOL WINAPI ChooseColorA(LPCHOOSECOLORA); +BOOL WINAPI ChooseColorW(LPCHOOSECOLORW); +BOOL WINAPI ChooseFontA(LPCHOOSEFONTA); +BOOL WINAPI ChooseFontW(LPCHOOSEFONTW); +DWORD WINAPI CommDlgExtendedError(void); +HWND WINAPI FindTextA(LPFINDREPLACEA); +HWND WINAPI FindTextW(LPFINDREPLACEW); +short WINAPI GetFileTitleA(LPCSTR,LPSTR,WORD); +short WINAPI GetFileTitleW(LPCWSTR,LPWSTR,WORD); +BOOL WINAPI GetOpenFileNameA(LPOPENFILENAMEA); +BOOL WINAPI GetOpenFileNameW(LPOPENFILENAMEW); +BOOL WINAPI GetSaveFileNameA(LPOPENFILENAMEA); +BOOL WINAPI GetSaveFileNameW(LPOPENFILENAMEW); +BOOL WINAPI PageSetupDlgA(LPPAGESETUPDLGA); +BOOL WINAPI PageSetupDlgW(LPPAGESETUPDLGW); +BOOL WINAPI PrintDlgA(LPPRINTDLGA); +BOOL WINAPI PrintDlgW(LPPRINTDLGW); +HWND WINAPI ReplaceTextA(LPFINDREPLACEA); +HWND WINAPI ReplaceTextW(LPFINDREPLACEW); +HRESULT WINAPI PrintDlgExA(LPPRINTDLGEXA); +HRESULT WINAPI PrintDlgExW(LPPRINTDLGEXW); + unsigned long __cdecl _beginthreadex (void *, unsigned int, unsigned int (__stdcall *) (void *), void*, unsigned int, unsigned int*); void __cdecl _endthreadex (unsigned int); + +// sctproto: int (__stdcall *DirectDrawCreate)(void *, void *, void *) +// 08 sctproto: int (WINAPI *dx_Release)(void *iface) +// IDirectDraw +// 14 sctproto: int (WINAPI *ddraw1_CreatePalette)(void *iface, DWORD flags, PALETTEENTRY *entries, void **palette, void *) +// 18 sctproto: int (WINAPI *ddraw1_CreateSurface)(void *iface, void *surface_desc, void **surface, void *) +// 2C sctproto: int (WINAPI *ddraw1_GetCaps)(void *iface, void *driver_caps, void *hel_caps) +// 38 sctproto: int (WINAPI *ddraw1_GetGDISurface)(void *iface, void **surface) +// 44 sctproto: int (WINAPI *ddraw1_GetVerticalBlankStatus)(void *iface, BOOL *status) +// 50 sctproto: int (WINAPI *ddraw1_SetCooperativeLevel)(void *iface, HWND window, DWORD flags) +// 54 sctproto: int (WINAPI *ddraw1_SetDisplayMode)(void *iface, DWORD width, DWORD height, DWORD bpp) +// 58 sctproto: int (WINAPI *ddraw1_WaitForVerticalBlank)(void *iface, DWORD flags, HANDLE event) +// IDirectDrawPalette +// 10 sctproto: int (WINAPI *palette_GetEntries)(void *, DWORD flags, DWORD start, DWORD count, PALETTEENTRY *entries) +// 18 sctproto: int (WINAPI *palette_SetEntries)(void *, DWORD flags, DWORD start, DWORD count, PALETTEENTRY *entries) +// IDirectDrawSurface +// 14 sctproto: int (WINAPI *surface1_Blt)(void *, RECT *, void *, RECT *, DWORD, void *) +// 30 sctproto: int (WINAPI *surface1_GetAttachedSurface)(void *, void *caps, void **attachment) +// 38 sctproto: int (WINAPI *surface1_GetCaps)(void *iface, void *caps) +// 64 sctproto: int (WINAPI *surface1_Lock)(void *, void *, void *, DWORD, HANDLE) +// 6C sctproto: int (WINAPI *surface1_Restore)(void *) +// 7C sctproto: int (WINAPI *surface1_SetPalette)(void *iface, void *palette) +// 80 sctproto: int (WINAPI *surface1_Unlock)(void *, void *) + + -- 2.39.5