+static int guess_lmod_from_c_type(struct parsed_opr *opr, const char *c_type)
+{
+ static const char *ptr_types[] = {
+ "LPCSTR",
+ };
+ static const char *dword_types[] = {
+ "int", "_DWORD", "DWORD", "HANDLE", "HWND", "HMODULE",
+ };
+ static const char *word_types[] = {
+ "__int16", "unsigned __int16",
+ };
+ static const char *byte_types[] = {
+ "char", "__int8", "unsigned __int8", "BYTE",
+ };
+ int i;
+
+ if (strchr(c_type, '*')) {
+ opr->lmod = OPLM_DWORD;
+ opr->is_ptr = 1;
+ return 1;
+ }
+
+ for (i = 0; i < ARRAY_SIZE(dword_types); i++) {
+ if (IS(c_type, dword_types[i])) {
+ opr->lmod = OPLM_DWORD;
+ return 1;
+ }
+ }
+
+ for (i = 0; i < ARRAY_SIZE(ptr_types); i++) {
+ if (IS(c_type, ptr_types[i])) {
+ opr->lmod = OPLM_DWORD;
+ opr->is_ptr = 1;
+ return 1;
+ }
+ }
+
+ for (i = 0; i < ARRAY_SIZE(word_types); i++) {
+ if (IS(c_type, word_types[i])) {
+ opr->lmod = OPLM_WORD;
+ return 1;
+ }
+ }
+
+ for (i = 0; i < ARRAY_SIZE(byte_types); i++) {
+ if (IS(c_type, byte_types[i])) {
+ opr->lmod = OPLM_BYTE;
+ return 1;
+ }
+ }
+
+ anote("unhandled C type '%s' for '%s'\n", c_type, opr->name);
+ return 0;
+}
+