translate: handle yet more things
[ia32rtools.git] / tools / protoparse.h
index 2894128..93129a1 100644 (file)
@@ -192,12 +192,14 @@ static const char *known_ptr_types[] = {
        "HACCEL",
        "HANDLE",
        "HBITMAP",
+       "HBRUSH",
        "HCALL",
        "HCURSOR",
        "HDC",
        "HFONT",
        "HGDIOBJ",
        "HGLOBAL",
+       "HHOOK",
        "HICON",
        "HINSTANCE",
        "HIMC", // DWORD in mingw, ptr in wine..
@@ -217,13 +219,19 @@ static const char *known_ptr_types[] = {
        "PDWORD",
        "PFILETIME",
        "PLARGE_INTEGER",
+       "PHANDLE",
        "PHKEY",
        "PLONG",
        "PMEMORY_BASIC_INFORMATION",
        "PUINT",
+       "PULARGE_INTEGER",
+       "PULONG_PTR",
        "PVOID",
        "PCVOID",
        "PWORD",
+       "REFCLSID",
+       "REFIID",
+       "HOOKPROC",
        "DLGPROC",
        "TIMERPROC",
        "WNDENUMPROC",
@@ -512,7 +520,7 @@ static int parse_protostr(char *protostr, struct parsed_proto *pp)
                pp->is_stdcall = 0; // custom
                pp->is_userstack = 1;
        }
-       else if (IS(cconv, "WINAPI"))
+       else if (IS(cconv, "WINAPI") || IS(cconv, "PASCAL"))
                pp->is_stdcall = 1;
        else {
                printf("%s:%d:%zd: unhandled cconv: '%s'\n",
@@ -659,8 +667,8 @@ static int parse_protostr(char *protostr, struct parsed_proto *pp)
                        pp->has_retreg |= is_retreg;
                }
 
-               if (strstr(arg->type.name, "int64")
-                   || IS(arg->type.name, "double"))
+               if (!arg->type.is_ptr && (strstr(arg->type.name, "int64")
+                     || IS(arg->type.name, "double")))
                {
                        // hack..
                        free(arg->type.name);
@@ -861,7 +869,8 @@ static const struct parsed_proto *proto_parse(FILE *fhdr, const char *sym,
        if (pp_cache == NULL)
                build_caches(fhdr);
 
-       if (sym[0] == '_') // && strncmp(fname, "stdc", 4) == 0)
+       // ugh...
+       if (sym[0] == '_' && !IS_START(sym, "__W"))
                sym++;
 
        strcpy(pp_search.name, sym);