Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assumption that sizeof(DWORD)==sizeof(void*) in find_imported_module_by_funcname #7

Closed
GoogleCodeExporter opened this issue Mar 15, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

http://code.google.com/p/win-iconv/source/browse/trunk/win_iconv.c#1194

This generates a half-dozen warnings and potentially won't work when compiling 
for 64 bit windows.
It'd probably be better to declare base as size_t and change the casts 
accordingly.

Original issue reported on code.google.com by j.g.renn...@gmail.com on 3 Aug 2011 at 5:10

@GoogleCodeExporter
Copy link
Author

Thank you for your report.
I don't have 64 bit Windows.
Let's keep this issue until someone fix it.

Original comment by yukihiro...@gmail.com on 18 Aug 2011 at 12:06

@GoogleCodeExporter
Copy link
Author

The last line of the first comment is the fix. I'll send a diff for this and 
the other one when I get home from work.

Original comment by j.g.renn...@gmail.com on 18 Aug 2011 at 12:17

@GoogleCodeExporter
Copy link
Author

--- win_iconv.c
+++ win_iconv.c
@@ -1185,13 +1185,13 @@
 static HMODULE
 find_imported_module_by_funcname(HMODULE hModule, const char *funcname)
 {
-    DWORD Base;
+    size_t Base;
     ULONG Size;
     PIMAGE_IMPORT_DESCRIPTOR Imp;
     PIMAGE_THUNK_DATA Name;         /* Import Name Table */
     PIMAGE_IMPORT_BY_NAME ImpName;

-    Base = (DWORD)hModule;
+    Base = (size_t)hModule;
     Imp = MyImageDirectoryEntryToData(
             (LPVOID)Base,
             TRUE,
@@ -1207,7 +1207,7 @@
             if (!IMAGE_SNAP_BY_ORDINAL(Name->u1.Ordinal))
             {
                 ImpName = (PIMAGE_IMPORT_BY_NAME)
-                    (Base + (DWORD)Name->u1.AddressOfData);
+                    (Base + (size_t)Name->u1.AddressOfData);
                 if (strcmp((char *)ImpName->Name, funcname) == 0)
                     return GetModuleHandleA((char *)(Base + Imp->Name));
             }

Original comment by j.g.renn...@gmail.com on 18 Aug 2011 at 10:45

@GoogleCodeExporter
Copy link
Author

Thank you.
Fixed by r26.

Original comment by yukihiro...@gmail.com on 19 Aug 2011 at 12:35

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant