[2] | 1 | //
|
---|
| 2 | // MINSTALL.DLL (c) Copyright 2002-2005 Martin Kiewitz
|
---|
| 3 | //
|
---|
| 4 | // This file is part of MINSTALL.DLL for OS/2 / eComStation
|
---|
| 5 | //
|
---|
| 6 | // MINSTALL.DLL is free software: you can redistribute it and/or modify
|
---|
| 7 | // it under the terms of the GNU General Public License as published by
|
---|
| 8 | // the Free Software Foundation, either version 3 of the License, or
|
---|
| 9 | // (at your option) any later version.
|
---|
| 10 | //
|
---|
| 11 | // MINSTALL.DLL is distributed in the hope that it will be useful,
|
---|
| 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | // GNU General Public License for more details.
|
---|
| 15 | //
|
---|
| 16 | // You should have received a copy of the GNU General Public License
|
---|
| 17 | // along with MINSTALL.DLL. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 18 | //
|
---|
| 19 |
|
---|
| 20 | #define INCL_NOPMAPI
|
---|
| 21 | #define INCL_BASE
|
---|
| 22 | #define INCL_DOSMODULEMGR
|
---|
| 23 | // #define INCL_OS2MM
|
---|
| 24 | #include <os2.h>
|
---|
| 25 | // #include <os2me.h>
|
---|
| 26 | #include <malloc.h>
|
---|
| 27 |
|
---|
| 28 | #include <global.h>
|
---|
| 29 | #include <crcs.h>
|
---|
| 30 | #include <dll.h>
|
---|
| 31 | #include <file.h>
|
---|
| 32 | #include <globstr.h>
|
---|
| 33 | #include <msg.h>
|
---|
| 34 | #include <mciini.h> // My own MCI-SYSINFO routines...
|
---|
| 35 | #include <mmi_public.h>
|
---|
| 36 | #include <mmi_types.h>
|
---|
| 37 | #include <mmi_main.h>
|
---|
| 38 | #include <mmi_helper.h>
|
---|
| 39 | #include <mmi_msg.h>
|
---|
| 40 | #include <mmi_inistuff.h>
|
---|
| 41 | #include <mmi_imports.h>
|
---|
| 42 |
|
---|
| 43 | HMODULE MINSTIMP_MDMHandle = 0;
|
---|
| 44 | HMODULE MINSTIMP_SSMINIHandle = 0;
|
---|
| 45 | HMODULE MINSTIMP_MMIOHandle = 0;
|
---|
| 46 | CODE_MCISETSYSVALUE CODE_MciSetSysValue = 0;
|
---|
| 47 | CODE_SPIINSTALL CODE_SpiInstallFunc = 0;
|
---|
| 48 | CODE_MMIOINIFILEHANDLER CODE_mmioIniFileHandlerFunc = 0;
|
---|
| 49 | CODE_MMIOINIFILECODEC CODE_mmioIniFileCODECFunc = 0;
|
---|
| 50 | CODE_MMIOMIGRATEINIFILE CODE_mmioMigrateIniFileFunc = 0;
|
---|
| 51 |
|
---|
| 52 | BOOL MINSTALL_LinkInImports (void) {
|
---|
| 53 | // Remember this action for cleanup...
|
---|
| 54 | MINSTALL_Done |= MINSTDONE_LINKINIMPORTS;
|
---|
| 55 |
|
---|
| 56 | if (!(MINSTIMP_MDMHandle = DLL_Load("MDM.DLL"))) {
|
---|
| 57 | MINSTALL_TrappedError (MINSTMSG_CouldNotLinkIn); return FALSE; }
|
---|
| 58 | MCIINI_MciSendCommandFunc = (CODE_MCISENDCOMMAND)DLL_GetEntryPoint(MINSTIMP_MDMHandle, "mciSendCommand");
|
---|
| 59 | CODE_MciSetSysValue = (CODE_MCISETSYSVALUE)DLL_GetEntryPoint(MINSTIMP_MDMHandle, "mciSetSysValue");
|
---|
| 60 | if ((!MCIINI_MciSendCommandFunc) || (!CODE_MciSetSysValue)) {
|
---|
| 61 | MINSTALL_TrappedError (MINSTMSG_CouldNotLinkIn); return FALSE; }
|
---|
| 62 | if (!(MINSTIMP_SSMINIHandle = DLL_Load("SSMINI.DLL"))) {
|
---|
| 63 | MINSTALL_TrappedError (MINSTMSG_CouldNotLinkIn); return FALSE; }
|
---|
| 64 | CODE_SpiInstallFunc = (CODE_SPIINSTALL)DLL_GetEntryPoint(MINSTIMP_SSMINIHandle, "SpiInstall");
|
---|
| 65 | if (!CODE_SpiInstallFunc) {
|
---|
| 66 | MINSTALL_TrappedError (MINSTMSG_CouldNotLinkIn); return FALSE; }
|
---|
| 67 | if (!(MINSTIMP_MMIOHandle = DLL_Load("MMIO.DLL"))) {
|
---|
| 68 | MINSTALL_TrappedError (MINSTMSG_CouldNotLinkIn); return FALSE; }
|
---|
| 69 | CODE_mmioIniFileHandlerFunc = (CODE_MMIOINIFILEHANDLER)DLL_GetEntryPoint(MINSTIMP_MMIOHandle, "mmioIniFileHandler");
|
---|
| 70 | CODE_mmioIniFileCODECFunc = (CODE_MMIOINIFILECODEC)DLL_GetEntryPoint(MINSTIMP_MMIOHandle, "mmioIniFileCODEC");
|
---|
| 71 | CODE_mmioMigrateIniFileFunc = (CODE_MMIOMIGRATEINIFILE)DLL_GetEntryPoint(MINSTIMP_MMIOHandle, "mmioMigrateIniFile");
|
---|
| 72 | if ((!CODE_mmioIniFileHandlerFunc) || (!CODE_mmioIniFileCODECFunc) || (!CODE_mmioMigrateIniFileFunc)) {
|
---|
| 73 | MINSTALL_TrappedError (MINSTMSG_CouldNotLinkIn); return FALSE; }
|
---|
| 74 |
|
---|
| 75 | return TRUE;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | VOID MINSTALL_CleanUpImports (void) {
|
---|
| 79 | if (MINSTIMP_MDMHandle)
|
---|
| 80 | DLL_UnLoad (MINSTIMP_MDMHandle);
|
---|
| 81 | }
|
---|
| 82 |
|
---|
| 83 | VOID MINSTALL_MigrateMMPMMMIOFile (void) {
|
---|
| 84 | // This is an undocumented API, that migrates current MMPMMMIO.INI file,
|
---|
| 85 | // if available or generates a new one.
|
---|
| 86 | (*CODE_mmioMigrateIniFileFunc) (0);
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | VOID MINSTALL_LowerMasterVolume (void) {
|
---|
| 90 | // This is called on base-installations to set master volume to 60.
|
---|
| 91 | (*CODE_MciSetSysValue) (1, 60);
|
---|
| 92 | }
|
---|