2 * Copyright 1995 Martin von Loewis
22 WIN32_builtin
*WIN32_builtin_list
;
24 /* Functions are in generated code */
31 void WINPROCS32_Init();
33 int RELAY32_Init(void)
36 /* Add a call for each DLL */
45 /* Why should it fail, anyways? */
49 WIN32_builtin
*RELAY32_GetBuiltinDLL(char *name
)
55 len
= (cp
=strchr(name
,'.')) ? (cp
-name
) : strlen(name
);
56 for(it
=WIN32_builtin_list
;it
;it
=it
->next
)
57 if(lstrncmpi(name
,it
->name
,len
)==0)
62 void RELAY32_Unimplemented(char *dll
, int item
)
65 fprintf( stderr
, "No handler for routine %s.%d", dll
, item
);
66 Dll
=RELAY32_GetBuiltinDLL(dll
);
67 if(Dll
&& Dll
->functions
[item
].name
)
68 fprintf(stderr
, "(%s?)\n", Dll
->functions
[item
].name
);
70 fprintf(stderr
, "\n");
75 void *RELAY32_GetEntryPoint(char *dll_name
, char *item
, int hint
)
82 struct PE_Export_Directory
* pe_exports
;
83 unsigned int load_addr
;
85 dprintf_module(stddeb
, "Looking for %s in %s, hint %x\n",
86 item
? item
: "(no name)", dll_name
, hint
);
87 dll
=RELAY32_GetBuiltinDLL(dll_name
);
88 /* This should deal with built-in DLLs only. See pe_module on loading
92 if(!wine_files
|| !wine_files
->name
||
93 lstrcmpi(dll_name
, wine_files
->name
)) {
94 LoadModule(dll_name
, (LPVOID
) -1);
95 if(!wine_files
|| !wine_files
->name
||
96 lstrcmpi(dll_name
, wine_files
->name
))
99 load_addr
= wine_files
->load_addr
;
100 pe_exports
= wine_files
->pe
->pe_export
;
101 ordinal
= (u_short
*) (((char *) load_addr
) + (int) pe_exports
->Address_Of_Name_Ordinals
);
102 function
= (u_long
*) (((char *) load_addr
) + (int) pe_exports
->AddressOfFunctions
);
103 name
= (u_char
**) (((char *) load_addr
) + (int) pe_exports
->AddressOfNames
);
104 /* import by ordinal */
108 /* hint is correct */
110 if(hint
&& hint
<dll
->size
&&
111 dll
->functions
[hint
].name
&&
112 strcmp(item
,dll
->functions
[hint
].name
)==0)
113 return dll
->functions
[hint
].definition
;
115 /* hint is incorrect, search for name */
116 for(i
=0;i
<pe_exports
->Number_Of_Functions
;i
++)
117 if (name
[i
] && !strcmp(item
,name
[i
]+load_addr
))
118 return function
[i
]+(char *)load_addr
;
120 /* function at hint has no name (unimplemented) */
122 if(hint
&& hint
<dll
->size
&& !dll
->functions
[hint
].name
)
124 dll
->functions
[hint
].name
=xstrdup(item
);
125 dprintf_module(stddeb
, "Returning unimplemented function %s.%d\n",
127 return dll
->functions
[hint
].definition
;
130 printf("Not found\n");
134 /* import by ordinal */
136 if(hint
&& hint
<dll
->size
)return dll
->functions
[hint
].definition
;
139 /* hint is correct */
140 if(hint
&& hint
<dll
->size
&&
141 dll
->functions
[hint
].name
&&
142 strcmp(item
,dll
->functions
[hint
].name
)==0)
143 return dll
->functions
[hint
].definition
;
144 /* hint is incorrect, search for name */
145 for(i
=0;i
<dll
->size
;i
++)
146 if (dll
->functions
[i
].name
&& !strcmp(item
,dll
->functions
[i
].name
))
147 return dll
->functions
[i
].definition
;
149 /* function at hint has no name (unimplemented) */
150 if(hint
&& hint
<dll
->size
&& !dll
->functions
[hint
].name
)
152 dll
->functions
[hint
].name
=xstrdup(item
);
153 dprintf_module(stddeb
, "Returning unimplemented function %s.%d\n",
155 return dll
->functions
[hint
].definition
;
160 void RELAY32_DebugEnter(char *dll
,char *name
)
162 dprintf_relay(stddeb
, "Entering %s.%s\n",dll
,name
);
165 LONG
RELAY32_CallWindowProc( WNDPROC func
, int hwnd
, int message
,
166 int wParam
, int lParam
)
176 : "g" (lParam
), "g" (wParam
), "g" (message
), "g" (hwnd
), "g" (func
)