9 #include "prototypes.h"
14 typedef struct module_table_entry
21 extern struct w_files
* wine_files
;
25 extern struct dll_name_table_entry_s dll_builtin_table
[N_BUILTINS
];
27 /**********************************************************************
28 * GetCurrentTask [KERNEL.36]
30 HTASK
GetCurrentTask()
33 printf("GetCurrentTask() returned %d !\n", pid
);
38 /**********************************************************************
39 * GetModuleHandle [KERNEL.47]
41 HANDLE
GetModuleHandle(LPSTR lpModuleName
)
43 register struct w_files
*w
= wine_files
;
45 printf("GetModuleHandle('%s');\n", lpModuleName
);
47 /* printf("GetModuleHandle // '%s' \n", w->name); */
48 if (strcmp(w
->name
, lpModuleName
) == 0) {
49 printf("GetModuleHandle('%s') return %04X \n",
50 lpModuleName
, w
->hinstance
);
55 for (i
= 0; i
< N_BUILTINS
; i
++) {
56 if (strcmp(dll_builtin_table
[i
].dll_name
, lpModuleName
) == 0) {
57 printf("GetModuleHandle('%s') return %04X \n",
58 lpModuleName
, 0xFF00 + i
);
62 printf("GetModuleHandle('%s') not found !\n", lpModuleName
);
67 /**********************************************************************
68 * GetModuleUsage [KERNEL.48]
70 int GetModuleUsage(HANDLE hModule
)
73 printf("GetModuleUsage(%04X);\n", hModule
);
74 w
= GetFileInfo(hModule
);
75 /* return w->Usage; */
80 /**********************************************************************
81 * GetModuleFilename [KERNEL.49]
83 int GetModuleFileName(HANDLE hModule
, LPSTR lpFileName
, short nSize
)
86 printf("GetModuleFileName(%04X, %08X, %d);\n", hModule
, lpFileName
, nSize
);
87 if (lpFileName
== NULL
) return 0;
88 w
= GetFileInfo(hModule
);
89 if (w
== NULL
) return 0;
90 if (nSize
> strlen(w
->name
)) nSize
= strlen(w
->name
) + 1;
91 strncpy(lpFileName
, w
->name
, nSize
);
92 printf("GetModuleFileName copied '%s' return %d \n", lpFileName
, nSize
);
97 /**********************************************************************
98 * LoadLibrary [KERNEL.95]
100 HANDLE
LoadLibrary(LPSTR libname
)
103 printf("LoadLibrary '%s'\n", libname
);
104 hModule
= LoadImage(libname
, DLL
);
105 printf("LoadLibrary returned hModule=%04X\n", hModule
);
110 /**********************************************************************
111 * FreeLibrary [KERNEL.96]
113 void FreeLibrary(HANDLE hLib
)
115 printf("FreeLibrary(%04X);\n", hLib
);
116 if (hLib
!= (HANDLE
)NULL
) GlobalFree(hLib
);
120 /**********************************************************************
121 * GetProcAddress [KERNEL.50]
123 FARPROC
GetProcAddress(HANDLE hModule
, char *proc_name
)
127 register struct w_files
*w
= wine_files
;
132 printf("GetProcAddress: Bad Module handle=%#04X\n", hModule
);
135 if (hModule
>= 0xF000) {
136 if ((int) proc_name
& 0xffff0000) {
137 printf("GetProcAddress: builtin %#04x, '%s'\n", hModule
, proc_name
);
138 /* wOrdin = FindOrdinalFromName(struct dll_table_entry_s *dll_table, proc_name); */
141 printf("GetProcAddress: builtin %#04x, %d\n", hModule
, (int) proc_name
);
145 while (w
&& w
->hinstance
!= hModule
) w
= w
->next
;
146 printf("GetProcAddress // Module Found ! w->filename='%s'\n", w
->filename
);
147 if (w
== NULL
) return NULL
;
148 if ((int) proc_name
& 0xffff0000) {
149 AnsiUpper(proc_name
);
150 printf("GetProcAddress: %#04x, '%s'\n", hModule
, proc_name
);
151 cpnt
= w
->nrname_table
;
153 if (((int) cpnt
) - ((int)w
->nrname_table
) >
154 w
->ne_header
->nrname_tab_length
) return NULL
;
156 strncpy(C
, cpnt
, len
);
158 printf("pointing Function '%s' !\n", C
);
159 if (strncmp(cpnt
, proc_name
, len
) == 0) break;
162 ordinal
= *((unsigned short *) (cpnt
+ len
));
165 printf("GetProcAddress: %#04x, %d\n", hModule
, (int) proc_name
);
166 ordinal
= (int)proc_name
;
168 ret
= GetEntryPointFromOrdinal(w
, ordinal
);
170 printf("GetProcAddress // Function not found !\n");
175 printf("GetProcAddress // ret=%08X sel=%04X addr=%04X\n", ret
, sel
, addr
);
179 #endif /* ifndef WINELIB */