1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
4 * WINE Drivers functions
6 * Copyright 1994 Martin Ayotte
7 * Copyright 1998 Marcus Meissner
8 * Copyright 1999 Eric Pouech
11 #include "wine/winuser16.h"
20 static LPWINE_DRIVER lpDrvItemList = NULL;
23 * - LoadModule count and clean up is not handled correctly (it's not a problem as
24 * long as FreeLibrary is not working correctly
25 * - msacm has some FIXME related to new code here...
28 /**************************************************************************
29 * LoadStartupDrivers [internal]
31 static void DRIVER_LoadStartupDrivers(void)
37 if (GetPrivateProfileString32A("drivers", NULL, "", str, sizeof(str), "SYSTEM.INI") < 2) {
38 ERR(driver,"Can't find drivers section in system.ini\n");
42 for (ptr = str; lstrlen32A(ptr) != 0; ptr += lstrlen32A(ptr) + 1) {
43 TRACE(driver, "str='%s'\n", ptr);
44 hDrv = OpenDriver16(ptr, "drivers", 0L);
45 TRACE(driver, "hDrv=%04x\n", hDrv);
47 TRACE(driver, "end of list !\n");
51 /**************************************************************************
52 * DRIVER_GetNumberOfModuleRefs [internal]
54 * Returns the number of open drivers which share the same module.
56 static WORD DRIVER_GetNumberOfModuleRefs(LPWINE_DRIVER lpNewDrv)
59 DWORD type = lpNewDrv->dwFlags & WINE_DI_TYPE_MASK;
62 for (lpDrv = lpDrvItemList; lpDrv; lpDrv = lpDrv->lpNextItem) {
63 if ((lpDrv->dwFlags & WINE_DI_TYPE_MASK) == type) {
66 if (lpDrv->d.d16.hModule == lpNewDrv->d.d16.hModule)
70 if (lpDrv->d.d32.hModule == lpNewDrv->d.d32.hModule)
74 FIXME(driver, "Unsupported driver type: %ld\n", type);
82 static LPWINE_DRIVER DRIVER_FindFromHDrvr16(HDRVR16 hDrvr)
86 for (lpDrv = lpDrvItemList; lpDrv; lpDrv = lpDrv->lpNextItem) {
87 if (lpDrv->hDriver16 == hDrvr) {
94 /**************************************************************************
95 * DRIVER_MapMsg16To32 [internal]
97 * Map a 16 bit driver message to a 32 bit driver message.
98 * 1 : ok, some memory allocated, need to call DRIVER_UnMapMsg16To32
99 * 0 : ok, no memory allocated
100 * -1 : ko, unknown message
101 * -2 : ko, memory problem
103 int DRIVER_MapMsg16To32(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
112 case DRV_QUERYCONFIGURE:
114 case DRV_EXITSESSION:
115 case DRV_EXITAPPLICATION:
117 /* lParam1 and lParam2 are not used */
122 /* lParam1 is a NULL terminated string, lParam2 is unknown => may lead to some problem */
124 *lParam1 = (DWORD)PTR_SEG_TO_LIN(*lParam1);
129 /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO */
131 LPDRVCONFIGINFO32 dci32 = HeapAlloc(SystemHeap, 0, sizeof(DRVCONFIGINFO32));
132 LPDRVCONFIGINFO16 dci16 = PTR_SEG_TO_LIN(*lParam2);
135 dci32->dwDCISize = sizeof(DRVCONFIGINFO32);
136 dci32->lpszDCISectionName = HEAP_strdupAtoW(SystemHeap, 0, PTR_SEG_TO_LIN(dci16->lpszDCISectionName));
137 dci32->lpszDCIAliasName = HEAP_strdupAtoW(SystemHeap, 0, PTR_SEG_TO_LIN(dci16->lpszDCIAliasName));
138 if (dci32->lpszDCISectionName == NULL || dci32->lpszDCIAliasName == NULL)
143 *lParam2 = (DWORD)dci32;
150 FIXME(driver, "Unknown message 0x%04x\n", wMsg);
155 /**************************************************************************
156 * DRIVER_MapMsg16To32 [internal]
158 * UnMap a 16 bit driver message to a 32 bit driver message.
161 * -2 : ko, memory problem
163 int DRIVER_UnMapMsg16To32(WORD wMsg, DWORD lParam1, DWORD lParam2)
172 case DRV_QUERYCONFIGURE:
174 case DRV_EXITSESSION:
175 case DRV_EXITAPPLICATION:
177 /* lParam1 and lParam2 are not used */
180 /* lParam1 is a NULL terminated string, lParam2 is unknown => may lead to some problem */
185 /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */
187 LPDRVCONFIGINFO32 dci32 = (LPDRVCONFIGINFO32)lParam2;
188 HeapFree(SystemHeap, 0, (LPVOID)dci32->lpszDCISectionName);
189 HeapFree(SystemHeap, 0, (LPVOID)dci32->lpszDCIAliasName);
190 HeapFree(SystemHeap, 0, dci32);
195 FIXME(driver, "Unknown message 0x%04x\n", wMsg);
200 /**************************************************************************
201 * DRIVER_MapMsg32To16 [internal]
203 * Map a 32 bit driver message to a 16 bit driver message.
204 * 1 : ok, some memory allocated, need to call DRIVER_UnMapMsg32To16
205 * 0 : ok, no memory allocated
206 * -1 : ko, unknown message
207 * -2 : ko, memory problem
209 int DRIVER_MapMsg32To16(WORD wMsg, DWORD* lParam1, DWORD* lParam2)
218 case DRV_QUERYCONFIGURE:
220 case DRV_EXITSESSION:
221 case DRV_EXITAPPLICATION:
223 /* lParam1 and lParam2 are not used */
228 /* lParam1 is a NULL terminated string, lParam2 is unknown => may lead to some problem */
230 LPSTR str = SEGPTR_STRDUP((LPSTR)*lParam1);
232 *lParam1 = (LPARAM)SEGPTR_GET(str);
243 /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO */
245 LPDRVCONFIGINFO16 dci16 = (LPDRVCONFIGINFO16)SEGPTR_ALLOC(sizeof(DRVCONFIGINFO16));
246 LPDRVCONFIGINFO32 dci32 = (LPDRVCONFIGINFO32)lParam2;
251 dci16->dwDCISize = sizeof(DRVCONFIGINFO16);
253 if ((str1 = HEAP_strdupWtoA(SystemHeap, 0, dci32->lpszDCISectionName)) != NULL &&
254 (str2 = SEGPTR_STRDUP(str1)) != NULL) {
255 dci16->lpszDCISectionName = (LPSTR)SEGPTR_GET(str2);
256 HeapFree(SystemHeap, 0, str1);
260 if ((str1 = HEAP_strdupWtoA(SystemHeap, 0, dci32->lpszDCIAliasName)) != NULL &&
261 (str2 = SEGPTR_STRDUP(str1)) != NULL) {
262 dci16->lpszDCIAliasName = (LPSTR)SEGPTR_GET(str2);
263 HeapFree(SystemHeap, 0, str1);
270 *lParam2 = (LPARAM)SEGPTR_GET(dci16);
277 FIXME(driver, "Unknown message 0x%04x\n", wMsg);
282 /**************************************************************************
283 * DRIVER_MapMsg32To16 [internal]
285 * UnMap a 32 bit driver message to a 16 bit driver message.
288 * -2 : ko, memory problem
290 int DRIVER_UnMapMsg32To16(WORD wMsg, DWORD lParam1, DWORD lParam2)
299 case DRV_QUERYCONFIGURE:
301 case DRV_EXITSESSION:
302 case DRV_EXITAPPLICATION:
304 /* lParam1 and lParam2 are not used */
307 /* lParam1 is a NULL terminated string, lParam2 is unknown => may lead to some problem */
308 if (lParam1) SEGPTR_FREE(PTR_SEG_TO_LIN(lParam1));
313 /* lParam1 is a handle to a window (or not used), lParam2 is a pointer to DRVCONFIGINFO, lParam2 */
315 LPDRVCONFIGINFO16 dci16 = (LPDRVCONFIGINFO16)PTR_SEG_TO_LIN(lParam2);
317 SEGPTR_FREE(PTR_SEG_TO_LIN(dci16->lpszDCISectionName));
318 SEGPTR_FREE(PTR_SEG_TO_LIN(dci16->lpszDCIAliasName));
324 FIXME(driver, "Unknown message 0x%04x\n", wMsg);
329 /**************************************************************************
330 * SendDriverMessage [USER.251]
332 LRESULT WINAPI SendDriverMessage16(HDRVR16 hDriver, UINT16 msg, LPARAM lParam1,
339 TRACE(driver, "(%04x, %04X, %08lX, %08lX)\n", hDriver, msg, lParam1, lParam2);
341 lpDrv = (LPWINE_DRIVER)DRIVER_FindFromHDrvr16(hDriver);
342 if (lpDrv != NULL && lpDrv->hDriver16 == hDriver) {
343 switch (lpDrv->dwFlags & WINE_DI_TYPE_MASK) {
344 case WINE_DI_TYPE_16:
345 retval = Callbacks->CallDriverProc(lpDrv->d.d16.lpDrvProc, lpDrv->dwDriverID, hDriver,
346 msg, lParam1, lParam2);
348 case WINE_DI_TYPE_32:
349 mapRet = DRIVER_MapMsg16To32(msg, &lParam1, &lParam2);
351 retval = lpDrv->d.d32.lpDrvProc(lpDrv->dwDriverID, hDriver, msg, lParam1, lParam2);
353 DRIVER_UnMapMsg16To32(msg, lParam1, lParam2);
360 FIXME(driver, "Unknown driver type %08lx\n", lpDrv->dwFlags);
365 TRACE(driver, "retval = %ld\n", retval);
369 /**************************************************************************
370 * SendDriverMessage [WINMM.19]
372 LRESULT WINAPI SendDriverMessage32(HDRVR32 hDriver, UINT32 msg, LPARAM lParam1,
375 LPWINE_DRIVER lpDrv = (LPWINE_DRIVER)hDriver;
379 TRACE(driver, "(%04x, %04X, %08lX, %08lX)\n", hDriver, msg, lParam1, lParam2);
382 switch (lpDrv->dwFlags & WINE_DI_TYPE_MASK) {
383 case WINE_DI_TYPE_16:
384 mapRet = DRIVER_MapMsg32To16(msg, &lParam1, &lParam2);
386 retval = Callbacks->CallDriverProc(lpDrv->d.d16.lpDrvProc, lpDrv->dwDriverID, hDriver,
387 msg, lParam1, lParam2);
389 DRIVER_UnMapMsg32To16(msg, lParam1, lParam2);
395 case WINE_DI_TYPE_32:
396 retval = lpDrv->d.d32.lpDrvProc(lpDrv->dwDriverID, hDriver, msg, lParam1, lParam2);
399 FIXME(driver, "Unknown driver type %08lx\n", lpDrv->dwFlags);
403 TRACE(driver, "retval = %ld\n", retval);
408 /**************************************************************************
409 * DRIVER_AddToList [internal]
411 * Adds a driver struct to the list of open drivers.
412 * Generates all the logic to handle driver creation / open.
414 static BOOL32 DRIVER_AddToList(LPWINE_DRIVER lpNewDrv, LPARAM lParam)
416 /* First driver to be loaded for this module, need to load correctly the module */
417 if (DRIVER_GetNumberOfModuleRefs(lpNewDrv) == 0) {
418 if (SendDriverMessage32((HDRVR32)lpNewDrv, DRV_LOAD, 0L, 0L) != DRV_SUCCESS) {
419 TRACE(driver, "DRV_LOAD failed on driver 0x%08lx\n", (DWORD)lpNewDrv);
422 if (SendDriverMessage32((HDRVR32)lpNewDrv, DRV_ENABLE, 0L, 0L) != DRV_SUCCESS) {
423 TRACE(driver, "DRV_ENABLE failed on driver 0x%08lx\n", (DWORD)lpNewDrv);
427 /* Now just open a new instance of a driver on this module */
428 /* Handle of this lParam is rather touchy :
429 * + we know here if it comes from 16 or 32 bit from lpDrv->dwFlags
430 * + but we don't know its content...
431 * + and we send it through SendDriverMessage32 as a 32 bit value...
432 * => so we might have trouble with this little guy (FIXME ???)
434 lpNewDrv->dwDriverID = SendDriverMessage32((HDRVR32)lpNewDrv, DRV_OPEN, (DWORD)lpNewDrv->szAliasName, lParam);
435 if (lpNewDrv->dwDriverID == 0) {
436 TRACE(driver, "DRV_OPEN failed on driver 0x%08lx\n", (DWORD)lpNewDrv);
440 lpNewDrv->lpNextItem = NULL;
441 if (lpDrvItemList == NULL) {
442 lpDrvItemList = lpNewDrv;
443 lpNewDrv->lpPrevItem = NULL;
445 LPWINE_DRIVER lpDrv = lpDrvItemList; /* find end of list */
446 while (lpDrv->lpNextItem != NULL)
447 lpDrv = lpDrv->lpNextItem;
449 lpDrv->lpNextItem = lpNewDrv;
450 lpNewDrv->lpPrevItem = lpDrv;
455 /**************************************************************************
456 * DRIVER_RemoveFromList [internal]
458 * Generates all the logic to handle driver closure / deletion
459 * Removes a driver struct to the list of open drivers.
461 static BOOL32 DRIVER_RemoveFromList(LPWINE_DRIVER lpDrv, LPARAM lParam1, LPARAM lParam2)
463 SendDriverMessage32((HDRVR32)lpDrv, DRV_CLOSE, lParam1, lParam2);
465 lpDrv->dwDriverID = 0;
466 if (DRIVER_GetNumberOfModuleRefs(lpDrv) == 1) {
467 SendDriverMessage16((HDRVR32)lpDrv, DRV_DISABLE, 0L, 0L);
468 SendDriverMessage16((HDRVR32)lpDrv, DRV_FREE, 0L, 0L);
470 if (lpDrv->lpPrevItem)
471 lpDrv->lpPrevItem->lpNextItem = lpDrv->lpNextItem;
473 lpDrvItemList = lpDrv->lpNextItem;
474 if (lpDrv->lpNextItem)
475 lpDrv->lpNextItem->lpPrevItem = lpDrv->lpPrevItem;
480 static HDRVR16 DRIVER_CreateDrvr16()
482 static WORD DRIVER_hDrvr16Counter = 0;
484 while (DRIVER_FindFromHDrvr16(++DRIVER_hDrvr16Counter));
485 return DRIVER_hDrvr16Counter;
488 /**************************************************************************
489 * DRIVER_RegisterDriver16 [internal]
491 * Creates all the WINE internal representations for a 16 bit driver.
492 * The driver is also open by sending the correct messages.
494 LPWINE_DRIVER DRIVER_RegisterDriver16(LPCSTR lpName, HMODULE16 hModule, DRIVERPROC16 lpProc, LPARAM lParam)
498 lpDrv = HeapAlloc(SystemHeap, 0, sizeof(WINE_DRIVER));
500 lpDrv->dwFlags = WINE_DI_TYPE_16;
501 lpDrv->dwDriverID = 0;
502 lpDrv->hDriver16 = DRIVER_CreateDrvr16();
503 strncpy(lpDrv->szAliasName, lpName, sizeof(lpDrv->szAliasName));
504 lpDrv->d.d16.hModule = hModule;
505 lpDrv->d.d16.lpDrvProc = lpProc;
507 if (!DRIVER_AddToList(lpDrv, lParam)) {
508 HeapFree(SystemHeap, 0, lpDrv);
515 /**************************************************************************
516 * DRIVER_RegisterDriver32 [internal]
518 * Creates all the WINE internal representations for a 32 bit driver.
519 * The driver is also open by sending the correct messages.
521 LPWINE_DRIVER DRIVER_RegisterDriver32(LPCSTR lpName, HMODULE32 hModule, DRIVERPROC32 lpProc, LPARAM lParam)
525 lpDrv = HeapAlloc(SystemHeap, 0, sizeof(WINE_DRIVER));
527 lpDrv->dwFlags = WINE_DI_TYPE_32;
528 lpDrv->dwDriverID = 0;
529 lpDrv->hDriver16 = DRIVER_CreateDrvr16();
530 strncpy(lpDrv->szAliasName, lpName, sizeof(lpDrv->szAliasName));
531 lpDrv->d.d32.hModule = hModule;
532 lpDrv->d.d32.lpDrvProc = lpProc;
534 if (!DRIVER_AddToList(lpDrv, lParam)) {
535 HeapFree(SystemHeap, 0, lpDrv);
542 /**************************************************************************
543 * DRIVER_TryOpenDriver32 [internal]
545 * Tries to load a 16 bit driver whose DLL's (module) name is lpFileName.
547 static HDRVR16 DRIVER_TryOpenDriver16(LPCSTR lpFileName, LPARAM lParam)
549 LPWINE_DRIVER lpDrv = NULL;
554 TRACE(driver,"('%s', %08lX);\n", lpFileName, lParam);
556 if (lstrlen32A(lpFileName) < 1)
559 lpSFN = strrchr(lpFileName, '\\');
560 lpSFN = (lpSFN) ? (lpSFN + 1) : lpFileName;
562 if ((hModule = LoadModule16(lpFileName, (LPVOID)-1)) != 0) {
563 if ((lpProc = (DRIVERPROC16)WIN32_GetProcAddress16(hModule, "DRIVERPROC")) != NULL) {
564 lpDrv = DRIVER_RegisterDriver16(lpSFN, hModule, lpProc, lParam);
566 TRACE(driver, "No DriverProc found\n");
569 TRACE(driver, "Unable to load module (%s)\n", lpFileName);
571 return lpDrv ? lpDrv->hDriver16 : 0;
574 /**************************************************************************
575 * DRIVER_TryOpenDriver32 [internal]
577 * Tries to load a 32 bit driver whose DLL's (module) name is lpFileName.
579 static HDRVR32 DRIVER_TryOpenDriver32(LPCSTR lpFileName, LPARAM lParam)
581 LPWINE_DRIVER lpDrv = NULL;
586 TRACE(driver,"('%s', %08lX);\n", lpFileName, lParam);
588 if (lstrlen32A(lpFileName) < 1)
591 lpSFN = strrchr(lpFileName, '\\');
592 lpSFN = (lpSFN) ? (lpSFN + 1) : lpFileName;
594 if ((hModule = LoadLibrary32A(lpFileName)) != 0) {
595 if ((lpProc = GetProcAddress32(hModule, "DriverProc")) != NULL) {
596 lpDrv = DRIVER_RegisterDriver32(lpSFN, hModule, lpProc, lParam);
598 TRACE(driver, "No DriverProc found\n");
601 TRACE(driver, "Unable to load module (%s)\n", lpFileName);
603 return (HDRVR32)lpDrv;
606 /**************************************************************************
607 * OpenDriver16 [USER.252]
609 HDRVR16 WINAPI OpenDriver16(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam)
614 TRACE(driver,"('%s', '%s', %08lX);\n", lpDriverName, lpSectionName, lParam);
616 if (lpSectionName == NULL) {
617 hDriver = DRIVER_TryOpenDriver16(lpDriverName, lParam);
619 /* in case hDriver is NULL, search in Drivers32 section */
620 lpSectionName = "Drivers";
623 if (!hDriver && GetPrivateProfileString32A(lpSectionName, lpDriverName, "",
624 drvName, sizeof(drvName), "SYSTEM.INI") > 0) {
625 hDriver = DRIVER_TryOpenDriver16(drvName, lParam);
630 /**************************************************************************
631 * OpenDriver32A [WINMM.15]
632 * (0,1,DRV_LOAD ,0 ,0)
633 * (0,1,DRV_ENABLE,0 ,0)
634 * (0,1,DRV_OPEN ,buf[256],0)
636 HDRVR32 WINAPI OpenDriver32A(LPCSTR lpDriverName, LPCSTR lpSectionName, LPARAM lParam)
641 TRACE(driver,"('%s', '%s', %08lX);\n", lpDriverName, lpSectionName, lParam);
643 if (lpSectionName == NULL) {
644 strncpy(drvName, lpDriverName, sizeof(drvName));
645 hDriver = DRIVER_TryOpenDriver32(lpDriverName, lParam);
647 /* FIXME what has to be done on lParam ?? */
648 hDriver = DRIVER_TryOpenDriver16(lpDriverName, lParam);
651 if (GetPrivateProfileString32A("Drivers32", lpDriverName, "", drvName,
652 sizeof(drvName), "SYSTEM.INI")) {
653 hDriver = DRIVER_TryOpenDriver32(drvName, lParam);
658 if (GetPrivateProfileString32A("Drivers", lpDriverName, "", drvName,
659 sizeof(drvName), "SYSTEM.INI")) {
660 hDriver = DRIVER_TryOpenDriver16(drvName, lParam);
665 if (GetPrivateProfileString32A(lpSectionName, lpDriverName, "", drvName,
666 sizeof(drvName), "SYSTEM.INI")) {
667 hDriver = DRIVER_TryOpenDriver32(drvName, lParam);
671 TRACE(driver, "retval='%08x'\n", hDriver);
675 /**************************************************************************
676 * OpenDriver32W [WINMM.15]
678 HDRVR32 WINAPI OpenDriver32W(LPCWSTR lpDriverName, LPCWSTR lpSectionName, LPARAM lParam)
680 LPSTR dn = HEAP_strdupWtoA(GetProcessHeap(), 0, lpDriverName);
681 LPSTR sn = HEAP_strdupWtoA(GetProcessHeap(), 0, lpSectionName);
682 HDRVR32 ret = OpenDriver32A(dn, sn, lParam);
684 if (dn) HeapFree(GetProcessHeap(), 0, dn);
685 if (sn) HeapFree(GetProcessHeap(), 0, sn);
689 /**************************************************************************
690 * CloseDriver [USER.253]
692 LRESULT WINAPI CloseDriver16(HDRVR16 hDrvr, LPARAM lParam1, LPARAM lParam2)
696 TRACE(driver, "(%04x, %08lX, %08lX);\n", hDrvr, lParam1, lParam2);
698 lpDrv = DRIVER_FindFromHDrvr16(hDrvr);
699 if (lpDrv != NULL && lpDrv->hDriver16 == hDrvr) {
700 if (DRIVER_RemoveFromList(lpDrv, lParam1, lParam2)) {
701 TRACE(driver, "hDrvr=%04x closed !\n", hDrvr);
707 /**************************************************************************
708 * CloseDriver32 [WINMM.4]
710 LRESULT WINAPI CloseDriver32(HDRVR32 hDrvr, LPARAM lParam1, LPARAM lParam2)
714 TRACE(driver, "(%04x, %08lX, %08lX);\n", hDrvr, lParam1, lParam2);
716 lpDrv = (LPWINE_DRIVER)hDrvr;
718 if (DRIVER_RemoveFromList(lpDrv, lParam1, lParam2)) {
719 TRACE(driver, "hDrvr=%08x closed !\n", hDrvr);
726 /**************************************************************************
727 * GetDriverModuleHandle [USER.254]
729 HMODULE16 WINAPI GetDriverModuleHandle16(HDRVR16 hDrvr)
732 HMODULE16 hModule = 0;
734 TRACE(driver, "(%04x);\n", hDrvr);
736 lpDrv = DRIVER_FindFromHDrvr16(hDrvr);
737 if (lpDrv != NULL && lpDrv->hDriver16 == hDrvr &&
738 (lpDrv->dwFlags & WINE_DI_TYPE_MASK) == WINE_DI_TYPE_16) {
739 hModule = lpDrv->d.d16.hModule;
744 /**************************************************************************
745 * GetDriverModuleHandle [USER.254]
747 HMODULE32 WINAPI GetDriverModuleHandle32(HDRVR32 hDrvr)
749 LPWINE_DRIVER lpDrv = (LPWINE_DRIVER)hDrvr;
750 HMODULE32 hModule = 0;
752 TRACE(driver, "(%04x);\n", hDrvr);
754 if (lpDrv != NULL && (lpDrv->dwFlags & WINE_DI_TYPE_MASK) == WINE_DI_TYPE_32) {
755 hModule = lpDrv->d.d32.hModule;
760 /**************************************************************************
761 * DefDriverProc16 [USER.255]
763 LRESULT WINAPI DefDriverProc16(DWORD dwDevID, HDRVR16 hDriv, UINT16 wMsg,
764 LPARAM lParam1, LPARAM lParam2)
767 case DRV_LOAD: return (LRESULT)0L;
768 case DRV_FREE: return (LRESULT)0L;
769 case DRV_OPEN: return (LRESULT)0L;
770 case DRV_CLOSE: return (LRESULT)0L;
771 case DRV_ENABLE: return (LRESULT)0L;
772 case DRV_DISABLE: return (LRESULT)0L;
773 case DRV_QUERYCONFIGURE: return (LRESULT)0L;
774 case DRV_CONFIGURE: MessageBox32A(0, "Driver isn't configurable !", "Wine Driver", MB_OK); return (LRESULT)0L;
775 case DRV_INSTALL: return (LRESULT)DRVCNF_RESTART;
776 case DRV_REMOVE: return (LRESULT)DRVCNF_RESTART;
777 default: return (LRESULT)0L;
781 /**************************************************************************
782 * GetDriverInfo [USER.256]
784 BOOL16 WINAPI GetDriverInfo(HDRVR16 hDrvr, LPDRIVERINFOSTRUCT16 lpDrvInfo)
789 TRACE(driver, "(%04x, %p);\n", hDrvr, lpDrvInfo);
791 if (lpDrvInfo == NULL ||
792 lpDrvInfo->length != sizeof(DRIVERINFOSTRUCT16)) return FALSE;
794 lpDrv = DRIVER_FindFromHDrvr16(hDrvr);
795 if (lpDrv != NULL && lpDrv->hDriver16 == hDrvr &&
796 (lpDrv->dwFlags & WINE_DI_TYPE_MASK) == WINE_DI_TYPE_16) {
797 lpDrvInfo->hDriver = lpDrv->hDriver16;
798 lpDrvInfo->hModule = lpDrv->d.d16.hModule;
799 strncpy(lpDrvInfo->szAliasName, lpDrv->szAliasName, sizeof(lpDrvInfo->szAliasName));
806 /**************************************************************************
807 * GetNextDriver [USER.257]
809 HDRVR16 WINAPI GetNextDriver(HDRVR16 hDrvr, DWORD dwFlags)
814 TRACE(driver, "(%04x, %08lX);\n", hDrvr, dwFlags);
817 if (lpDrvItemList == NULL) {
818 FIXME(driver, "drivers list empty !\n");
819 /* FIXME: code was using DRIVER_LoadStartupDrivers(); before ?
820 * I (EPP) don't quite understand this
822 if (lpDrvItemList == NULL) return 0;
824 lpDrv = lpDrvItemList;
825 if (dwFlags & GND_REVERSE) {
826 while (lpDrv->lpNextItem)
827 lpDrv = lpDrv->lpNextItem;
830 lpDrv = DRIVER_FindFromHDrvr16(hDrvr);
832 if (dwFlags & GND_REVERSE) {
833 lpDrv = (lpDrv->lpPrevItem) ? lpDrv->lpPrevItem : NULL;
835 lpDrv = (lpDrv->lpNextItem) ? lpDrv->lpNextItem : NULL;
840 hRetDrv = (lpDrv) ? lpDrv->hDriver16 : (HDRVR16)0;
841 TRACE(driver, "return %04x !\n", hRetDrv);