From 9bbecbfbce7530f47af567605611f091f2bd84ad Mon Sep 17 00:00:00 2001 From: notaz Date: Fri, 6 Nov 2015 03:01:42 +0200 Subject: [PATCH] handle stuff, add funcs --- ida/saveasm/saveasm.cpp | 6 +++++- tools/cvt_data.c | 15 +++++++++++---- tools/translate.c | 6 ++++-- win32.hlist | 41 ++++++++++++++++++++++++++++++++--------- 4 files changed, 52 insertions(+), 16 deletions(-) diff --git a/ida/saveasm/saveasm.cpp b/ida/saveasm/saveasm.cpp index 38eb480..ea09fc2 100644 --- a/ida/saveasm/saveasm.cpp +++ b/ida/saveasm/saveasm.cpp @@ -526,7 +526,11 @@ static void idaapi run(int /*arg*/) int change_qat = 0; ea_flags = get_flags_novalue(ea); if (!isCode(ea_flags)) { - if (strchr(name, '?')) + if (IS_START(name, "__imp_")) + /* some import */; + else if (name[0] == '?' && strstr(name, "@@")) + /* c++ import */; + else if (strchr(name, '?')) change_qat = 1; else if ((cp = strchr(name, '@'))) { char *endp = NULL; diff --git a/tools/cvt_data.c b/tools/cvt_data.c index 692fa10..432e4c5 100644 --- a/tools/cvt_data.c +++ b/tools/cvt_data.c @@ -1,6 +1,6 @@ /* * ia32rtools - * (C) notaz, 2013,2014 + * (C) notaz, 2013-2015 * * This work is licensed under the terms of 3-clause BSD license. * See COPYING file in the top-level directory. @@ -239,7 +239,7 @@ static void sprint_pp_short(const struct parsed_proto *pp, char *buf, } static const struct parsed_proto *check_var(FILE *fhdr, - const char *sym, const char *varname) + const char *sym, const char *varname, int is_export) { const struct parsed_proto *pp, *pp_sym; char fp_sym[256], fp_var[256], *p; @@ -252,6 +252,8 @@ static const struct parsed_proto *check_var(FILE *fhdr, return NULL; } + if (is_export) + return NULL; if (!pp->is_func && !pp->is_fptr) return NULL; @@ -386,6 +388,7 @@ int main(int argc, char *argv[]) FILE *fout, *fasm, *fhdr = NULL, *frlist; const struct parsed_proto *pp; int no_decorations = 0; + int in_export_table = 0; char comment_char = '#'; char words[20][256]; char word[256]; @@ -467,7 +470,7 @@ int main(int argc, char *argv[]) while (my_fgets(line, sizeof(line), frlist)) { p = sskip(line); - if (*p == 0 || *p == ';') + if (*p == 0 || *p == ';' || *p == '#') continue; p = next_word(words[0], sizeof(words[0]), p); @@ -533,6 +536,10 @@ int main(int argc, char *argv[]) if (i != 0 && !header_mode) fprintf(fout, "\t\t .skip 0x%x\n", i); } + else if (IS_START(p, "; Export Address")) + in_export_table = 1; + else if (IS_START(p, "; Export")) + in_export_table = 0; continue; } @@ -797,7 +804,7 @@ int main(int argc, char *argv[]) snprintf(g_comment, sizeof(g_comment), "%s", p); } else { - pp = check_var(fhdr, sym, p); + pp = check_var(fhdr, sym, p, in_export_table); if (pp == NULL) { fprintf(fout, "%s%s", (no_decorations || p[0] == '_') ? "" : "_", p); diff --git a/tools/translate.c b/tools/translate.c index 3a35a5d..7da3b54 100644 --- a/tools/translate.c +++ b/tools/translate.c @@ -3942,8 +3942,10 @@ static void resolve_branches_parse_calls(int opcnt) && IS(po->operand[0].name, g_labels[l])) { if (l == i + 1 && po->op == OP_JMP) { - // yet another alignment type.. - po->flags |= OPF_RMD|OPF_DONE; + // yet another alignment type... + po->flags |= OPF_RMD | OPF_DONE; + po->flags &= ~OPF_JMP; + po->op = OP_NOP; break; } add_label_ref(&g_label_refs[l], i); diff --git a/win32.hlist b/win32.hlist index 4201238..5edb79d 100644 --- a/win32.hlist +++ b/win32.hlist @@ -665,25 +665,48 @@ WINBASEAPI BOOL WINAPI MapUserPhysicalPages(PVOID,ULONG_PTR,PULONG_PTR); WINBASEAPI BOOL WINAPI MapUserPhysicalPagesScatter(PVOID*,ULONG_PTR,PULONG_PTR); WINBASEAPI void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION); +WINBASEAPI int WINAPI CompareStringA(LCID,DWORD,LPCSTR,int,LPCSTR,int); +WINBASEAPI int WINAPI CompareStringW(LCID,DWORD,LPCWSTR,int,LPCWSTR,int); +WINBASEAPI UINT WINAPI GetACP(void); +WINBASEAPI int WINAPI GetCalendarInfoA(LCID,CALID,CALTYPE,LPSTR,int,LPDWORD); +WINBASEAPI int WINAPI GetCalendarInfoW(LCID,CALID,CALTYPE,LPWSTR,int,LPDWORD); +WINBASEAPI BOOL WINAPI GetCPInfo(UINT,LPCPINFO); WINBASEAPI BOOL WINAPI GetCPInfoExA(UINT,DWORD,LPCPINFOEXA); WINBASEAPI BOOL WINAPI GetCPInfoExW(UINT,DWORD,LPCPINFOEXW); -WINBASEAPI BOOL WINAPI GetCPInfo(UINT,LPCPINFO); +WINBASEAPI int WINAPI GetCurrencyFormatA(LCID,DWORD,LPCSTR,const CURRENCYFMTA*,LPSTR,int); +WINBASEAPI int WINAPI GetCurrencyFormatW(LCID,DWORD,LPCWSTR,const CURRENCYFMTW*,LPWSTR,int); +WINBASEAPI int WINAPI GetDateFormatA(LCID,DWORD,const SYSTEMTIME*,LPCSTR,LPSTR,int); +WINBASEAPI int WINAPI GetDateFormatW(LCID,DWORD,const SYSTEMTIME*,LPCWSTR,LPWSTR,int); +WINBASEAPI int WINAPI GetGeoInfoA(GEOID,GEOTYPE,LPSTR,int,LANGID); +WINBASEAPI int WINAPI GetGeoInfoW(GEOID,GEOTYPE,LPWSTR,int,LANGID); +WINBASEAPI int WINAPI GetLocaleInfoA(LCID,LCTYPE,LPSTR,int); +WINBASEAPI int WINAPI GetLocaleInfoW(LCID,LCTYPE,LPWSTR,int); +WINBASEAPI BOOL WINAPI GetNLSVersion(NLS_FUNCTION,LCID,LPNLSVERSIONINFO); +WINBASEAPI int WINAPI GetNumberFormatA(LCID,DWORD,LPCSTR,const NUMBERFMTA*,LPSTR,int); +WINBASEAPI int WINAPI GetNumberFormatW(LCID,DWORD,LPCWSTR,const NUMBERFMTW*,LPWSTR,int); +WINBASEAPI UINT WINAPI GetOEMCP(void); WINBASEAPI BOOL WINAPI GetStringTypeA(LCID,DWORD,LPCSTR,int,LPWORD); WINBASEAPI BOOL WINAPI GetStringTypeW(DWORD,LPCWSTR,int,LPWORD); +WINBASEAPI BOOL WINAPI GetStringTypeExA(LCID,DWORD,LPCSTR,int,LPWORD); +WINBASEAPI BOOL WINAPI GetStringTypeExW(LCID,DWORD,LPCWSTR,int,LPWORD); +WINBASEAPI LANGID WINAPI GetSystemDefaultLangID(void); +WINBASEAPI LCID WINAPI GetSystemDefaultLCID(void); +WINBASEAPI LCID WINAPI GetThreadLocale(void); + +WINBASEAPI int WINAPI GetTimeFormatA(LCID,DWORD,const SYSTEMTIME*,LPCSTR,LPSTR,int); +WINBASEAPI int WINAPI GetTimeFormatW(LCID,DWORD,const SYSTEMTIME*,LPCWSTR,LPWSTR,int); +WINBASEAPI LANGID WINAPI GetUserDefaultLangID(void); +WINBASEAPI LCID WINAPI GetUserDefaultLCID(void); +WINBASEAPI GEOID WINAPI GetUserGeoID(GEOCLASS); WINBASEAPI BOOL WINAPI IsDBCSLeadByte(BYTE); WINBASEAPI BOOL WINAPI IsDBCSLeadByteEx(UINT,BYTE); -WINBASEAPI int WINAPI CompareStringA(LCID,DWORD,LPCSTR,int,LPCSTR,int); -WINBASEAPI int WINAPI CompareStringW(LCID,DWORD,LPCWSTR,int,LPCWSTR,int); -WINBASEAPI int WINAPI GetDateFormatA(LCID,DWORD,const SYSTEMTIME*,LPCSTR,LPSTR,int); -WINBASEAPI int WINAPI GetLocaleInfoA(LCID,LCTYPE,LPSTR,int); -WINBASEAPI int WINAPI GetTimeFormatA(LCID,DWORD,const SYSTEMTIME*,LPCSTR,LPSTR,int); +WINBASEAPI BOOL WINAPI IsNLSDefinedString(NLS_FUNCTION,DWORD,LPNLSVERSIONINFO,LPCWSTR,int); +WINBASEAPI BOOL WINAPI IsValidCodePage(UINT); +WINBASEAPI BOOL WINAPI IsValidLocale(LCID,DWORD); WINBASEAPI int WINAPI LCMapStringA(LCID,DWORD,LPCSTR,int,LPSTR,int); WINBASEAPI int WINAPI LCMapStringW(LCID,DWORD,LPCWSTR,int,LPWSTR,int); WINBASEAPI int WINAPI MultiByteToWideChar(UINT,DWORD,LPCSTR,int,LPWSTR,int); WINBASEAPI int WINAPI WideCharToMultiByte(UINT,DWORD,LPCWSTR,int,LPSTR,int,LPCSTR,LPBOOL); -WINBASEAPI LANGID WINAPI GetUserDefaultLangID(void); -WINBASEAPI UINT WINAPI GetACP(void); -WINBASEAPI UINT WINAPI GetOEMCP(void); WINADVAPI LONG WINAPI RegDeleteValueA(HKEY,LPCSTR); WINADVAPI LONG WINAPI RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY); -- 2.39.2