Changeset 380
- Timestamp:
- May 22, 2009, 4:47:07 PM (16 years ago)
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1-0/src/helpers/acpih.c
r327 r380 17 17 18 18 /* 19 * Copyright (C) 2006 Paul Ratcliffe.19 * Copyright (C) 2006-2009 Paul Ratcliffe. 20 20 * This file is part of the "XWorkplace helpers" source package. 21 21 * This is free software; you can redistribute it and/or modify … … 49 49 ********************************************************************/ 50 50 51 HMODULE hmodACPI = NULLHANDLE; 51 HMODULE G_hmodACPI = NULLHANDLE; 52 ULONG G_ulCount = 0; 52 53 53 54 ACPISTARTAPI *pAcpiStartApi = NULL; … … 69 70 APIRET arc = NO_ERROR; 70 71 71 if (! hmodACPI)72 if (!G_hmodACPI) 72 73 if (!(arc = DosLoadModule(NULL, 73 74 0, 74 75 "ACPI32", 75 & hmodACPI)))76 &G_hmodACPI))) 76 77 { 77 arc = DosQueryProcAddr( hmodACPI,78 arc = DosQueryProcAddr(G_hmodACPI, 78 79 ORD_ACPISTARTAPI, 79 80 NULL, 80 81 (PFN *) &pAcpiStartApi); 81 82 if (!arc) 82 arc = DosQueryProcAddr( hmodACPI,83 arc = DosQueryProcAddr(G_hmodACPI, 83 84 ORD_ACPIENDAPI, 84 85 NULL, … … 86 87 87 88 if (!arc) 88 arc = DosQueryProcAddr( hmodACPI,89 arc = DosQueryProcAddr(G_hmodACPI, 89 90 ORD_ACPIGOTOSLEEP, 90 91 NULL, … … 92 93 if (arc) 93 94 { 94 DosFreeModule( hmodACPI);95 hmodACPI = NULLHANDLE;95 DosFreeModule(G_hmodACPI); 96 G_hmodACPI = NULLHANDLE; 96 97 pAcpiStartApi = NULL; 97 98 pAcpiEndApi = NULL; … … 104 105 return(arc); 105 106 else 107 { 108 G_ulCount++; 106 109 return(pAcpiStartApi(phACPI)); 110 } 107 111 } 108 112 … … 115 119 { 116 120 if (pAcpiEndApi) 121 { 117 122 pAcpiEndApi(phACPI); 123 G_ulCount--; 124 } 125 126 if (!G_ulCount) 127 { 128 DosFreeModule(G_hmodACPI); 129 G_hmodACPI = NULLHANDLE; 130 pAcpiStartApi = NULL; 131 pAcpiEndApi = NULL; 132 pAcpiGoToSleep = NULL; 133 } 118 134 } 119 135 -
trunk/src/helpers/acpih.c
r327 r380 17 17 18 18 /* 19 * Copyright (C) 2006 Paul Ratcliffe.19 * Copyright (C) 2006-2009 Paul Ratcliffe. 20 20 * This file is part of the "XWorkplace helpers" source package. 21 21 * This is free software; you can redistribute it and/or modify … … 49 49 ********************************************************************/ 50 50 51 HMODULE hmodACPI = NULLHANDLE; 51 HMODULE G_hmodACPI = NULLHANDLE; 52 ULONG G_ulCount = 0; 52 53 53 54 ACPISTARTAPI *pAcpiStartApi = NULL; … … 69 70 APIRET arc = NO_ERROR; 70 71 71 if (! hmodACPI)72 if (!G_hmodACPI) 72 73 if (!(arc = DosLoadModule(NULL, 73 74 0, 74 75 "ACPI32", 75 & hmodACPI)))76 &G_hmodACPI))) 76 77 { 77 arc = DosQueryProcAddr( hmodACPI,78 arc = DosQueryProcAddr(G_hmodACPI, 78 79 ORD_ACPISTARTAPI, 79 80 NULL, 80 81 (PFN *) &pAcpiStartApi); 81 82 if (!arc) 82 arc = DosQueryProcAddr( hmodACPI,83 arc = DosQueryProcAddr(G_hmodACPI, 83 84 ORD_ACPIENDAPI, 84 85 NULL, … … 86 87 87 88 if (!arc) 88 arc = DosQueryProcAddr( hmodACPI,89 arc = DosQueryProcAddr(G_hmodACPI, 89 90 ORD_ACPIGOTOSLEEP, 90 91 NULL, … … 92 93 if (arc) 93 94 { 94 DosFreeModule( hmodACPI);95 hmodACPI = NULLHANDLE;95 DosFreeModule(G_hmodACPI); 96 G_hmodACPI = NULLHANDLE; 96 97 pAcpiStartApi = NULL; 97 98 pAcpiEndApi = NULL; … … 104 105 return(arc); 105 106 else 107 { 108 G_ulCount++; 106 109 return(pAcpiStartApi(phACPI)); 110 } 107 111 } 108 112 … … 115 119 { 116 120 if (pAcpiEndApi) 121 { 117 122 pAcpiEndApi(phACPI); 123 G_ulCount--; 124 } 125 126 if (!G_ulCount) 127 { 128 DosFreeModule(G_hmodACPI); 129 G_hmodACPI = NULLHANDLE; 130 pAcpiStartApi = NULL; 131 pAcpiEndApi = NULL; 132 pAcpiGoToSleep = NULL; 133 } 118 134 } 119 135
Note:
See TracChangeset
for help on using the changeset viewer.