Changeset 6712 for trunk/src/msacm32/internal.c
- Timestamp:
- Sep 15, 2001, 11:47:44 AM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/msacm32/internal.c
r6648 r6712 1 1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */ 2 /* $Id: internal.c,v 1.2 2001-09-05 13:11:26 bird Exp $ */ 2 3 3 /* 4 4 * MSACM32 library 5 5 * 6 6 * Copyright 1998 Patrik Stridvall 7 * 1999Eric Pouech7 * 1999 Eric Pouech 8 8 */ 9 9 … … 34 34 35 35 /*********************************************************************** 36 * MSACM_RegisterDriver() 36 * MSACM_RegisterDriver() 37 37 */ 38 38 PWINE_ACMDRIVERID MSACM_RegisterDriver(LPSTR pszDriverAlias, LPSTR pszFileName, 39 40 { 39 HINSTANCE hinstModule) 40 { 41 41 PWINE_ACMDRIVERID padid; 42 42 … … 64 64 padid->pPrevACMDriverID = MSACM_pLastACMDriverID; 65 65 if (MSACM_pLastACMDriverID) 66 66 MSACM_pLastACMDriverID->pNextACMDriverID = padid; 67 67 MSACM_pLastACMDriverID = padid; 68 68 if (!MSACM_pFirstACMDriverID) 69 70 69 MSACM_pFirstACMDriverID = padid; 70 71 71 return padid; 72 72 } 73 73 74 74 /*********************************************************************** 75 * MSACM_RegisterAllDrivers() 75 * MSACM_RegisterAllDrivers() 76 76 */ 77 77 void MSACM_RegisterAllDrivers(void) … … 80 80 DWORD dwBufferLength; 81 81 82 /* FIXME 82 /* FIXME 83 83 * What if the user edits system.ini while the program is running? 84 84 * Does Windows handle that? 85 85 */ 86 86 if (MSACM_pFirstACMDriverID) 87 88 87 return; 88 89 89 /* FIXME: Do not work! How do I determine the section length? */ 90 90 dwBufferLength = 1024; 91 /* EPP 92 91 /* EPP GetPrivateProfileSectionA("drivers32", NULL, 0, "system.ini"); */ 92 93 93 pszBuffer = (LPSTR) HeapAlloc(MSACM_hHeap, 0, dwBufferLength); 94 94 if (GetPrivateProfileSectionA("drivers32", pszBuffer, dwBufferLength, "system.ini")) { 95 char* s = pszBuffer; 96 while (*s) { 97 if (!strncasecmp("MSACM.", s, 6)) { 98 char *s2 = s; 99 while (*s2 != '\0' && *s2 != '=') s2++; 100 if (*s2) { 101 *s2 = '\0'; 102 MSACM_RegisterDriver(s, s2 + 1, 0); 103 *s2 = '='; 104 } 105 } 106 s += strlen(s) + 1; /* Either next char or \0 */ 95 char* s = pszBuffer; 96 while (*s) { 97 if (!strncasecmp("MSACM.", s, 6)) { 98 char *s2 = s; 99 while (*s2 != '\0' && *s2 != '=') s2++; 100 if (*s2) { 101 *s2 = '\0'; 102 MSACM_RegisterDriver(s, s2 + 1, 0); 103 *s2 = '='; 104 } 105 } 106 s += strlen(s) + 1; /* Either next char or \0 */ 107 } 107 108 } 108 } 109 109 110 110 HeapFree(MSACM_hHeap, 0, pszBuffer); 111 111 … … 119 119 { 120 120 PWINE_ACMDRIVERID pNextACMDriverID; 121 121 122 122 while (p->pACMDriverList) 123 124 123 acmDriverClose((HACMDRIVER) p->pACMDriverList, 0); 124 125 125 if (p->pszDriverAlias) 126 126 HeapFree(MSACM_hHeap, 0, p->pszDriverAlias); 127 127 if (p->pszFileName) 128 129 128 HeapFree(MSACM_hHeap, 0, p->pszFileName); 129 130 130 if (p == MSACM_pFirstACMDriverID) 131 131 MSACM_pFirstACMDriverID = p->pNextACMDriverID; 132 132 if (p == MSACM_pLastACMDriverID) 133 133 MSACM_pLastACMDriverID = p->pPrevACMDriverID; 134 134 135 135 if (p->pPrevACMDriverID) 136 136 p->pPrevACMDriverID->pNextACMDriverID = p->pNextACMDriverID; 137 137 if (p->pNextACMDriverID) 138 139 138 p->pNextACMDriverID->pPrevACMDriverID = p->pPrevACMDriverID; 139 140 140 pNextACMDriverID = p->pNextACMDriverID; 141 141 142 142 HeapFree(MSACM_hHeap, 0, p); 143 143 144 144 return pNextACMDriverID; 145 145 } … … 162 162 PWINE_ACMOBJ MSACM_GetObj(HACMOBJ hObj, DWORD type) 163 163 { 164 PWINE_ACMOBJ 164 PWINE_ACMOBJ pao = (PWINE_ACMOBJ)hObj; 165 165 166 166 if (pao == NULL || IsBadReadPtr(pao, sizeof(WINE_ACMOBJ)) || 167 168 167 ((type != WINE_ACMOBJ_DONTCARE) && (type != pao->dwType))) 168 return NULL; 169 169 return pao; 170 170 } 171 171 172 172 /*********************************************************************** 173 * MSACM_GetDriverID() 173 * MSACM_GetDriverID() 174 174 */ 175 175 PWINE_ACMDRIVERID MSACM_GetDriverID(HACMDRIVERID hDriverID) … … 191 191 MMRESULT MSACM_Message(HACMDRIVER had, UINT uMsg, LPARAM lParam1, LPARAM lParam2) 192 192 { 193 PWINE_ACMDRIVER 193 PWINE_ACMDRIVER pad = MSACM_GetDriver(had); 194 194 195 195 return pad ? SendDriverMessage(pad->hDrvr, uMsg, lParam1, lParam2) : MMSYSERR_INVALHANDLE;
Note:
See TracChangeset
for help on using the changeset viewer.