pcs 98/02/24 06:26:57
Added: src/os/win32/installer/installdll install.c install.def
install.dsp install.mak
src/os/win32/installer/installdll/test resource.h test.c
test.def test.dsp test.h test.ico test.mak test.rc
Log:
Add code for the installer DLL. This is the file that replaces
the @@ServerRoot@@ sequences in the configuration files with
the real install directory.
Also here is a test program, in test/, which calls the installer DLL
and can be used to debug it.
Revision Changes Path
1.1 apache-1.3/src/os/win32/installer/installdll/install.c
Index: install.c
===================================================================
/* Apache Installer */
/*
* 26/06/97 PCS 1.000 Initial version
* 22/02/98 PCS 1.001 Used the excellent NTemacs to apply proper formating
*/
#include <windows.h>
#include <winsock.h>
#include <string.h>
#include <stdio.h>
/* Global to store the instance handle */
HINSTANCE hInstance = NULL;
/*
* MessageBox_error() is a helper function to display an error in a
* message box, optionally including a Win32 error message. If
* the "opt" argument is value AP_WIN32ERROR then get the last Win32
* error (with GetLastError()) and add it on to the end of
* the output string. The output string is given as a printf-format
* and replacement arguments. The hWnd, title and mb_opt fields are
* passed on to the Win32 MessageBox() call.
*
* We shouldn't use a fixed length buffer to build up the printf
* text. Umm.
*/
#define AP_WIN32ERROR 1
int MessageBox_error(HWND hWnd, int opt, char *title,
int mb_opt, char *fmt, ...)
{
char buf[4000];
va_list ap;
va_start(ap, fmt);
wvsprintf(buf, fmt, ap);
va_end(ap);
if (opt | AP_WIN32ERROR) {
char *p;
strcat(buf, "\r\r(");
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError(),
0,
buf + strlen(buf),
4000 - strlen(buf),
NULL);
p = buf+strlen(buf)-1;
while (*p == '\r' || *p == '\n')
p--;
p++;
*p = '\0';
strcat(buf, ")");
}
return MessageBox(hWnd, buf, title, opt);
}
/*
* The next few functions handle expanding the @@ServerRoot@@ type
* sequences found in the distribution files. The main entry point
* is expandFile(), which is given a file to expand and the filename
* to write the expanded file it. It reads a line at a time, and
* if the line includes an "@@" sequence, calls expandLine() to
* expand the sequences.
*
* expandLine() looks for @@ sequences in the line, and when it finds
* one, looks for a corresponding entry in the replaceTable[]. If it
* finds one it writes the replacement value from the table into
* an output string.
*
* The helper function appendText() is used when expanding strings. It
* is called to copy text into an output buffer. If the output buffer
* is not big enough, it is expanded. This function also ensures that
* the output buffer is null terminated after each append operation.
*
* A table is used of values to replace, rather than just hardcoding
* the functionality, so we could replace additional values in the
* future. We also take care to ensure that the expanded line can be
* arbitrary length (though at the moment the lines read from the
* configuration files can only be up to 2000 characters).
*/
/*
* Table of items to replace. The "value" elements are filled in at runtime
* by FillInReplaceTable(). Note that the "tmpl" element is case
* sensitive.
*/
typedef struct {
char *tmpl;
char *value;
} REPLACEITEM;
typedef REPLACEITEM *REPLACETABLE;
REPLACEITEM replaceHttpd[] = {
{ "@@ServerRoot@@", NULL }, /* ServerRoot directory (i.e. install
dir) */
{ NULL, NULL }
};
/*
* A relatively intelligent version of strcat, that expands the destination
* buffer if needed.
*
* On entry, ppBuf points to the output buffer, pnPos points to the offset
* of the current position within that buffer, and pnSize points to the
* current size of *ppBuf. pSrc points to the string to copy into the buffer,
* and nToCopy gives the number of characters to copy from pSrc.
*
* On exit, *ppBuf, *pnPos and *pnSize may have been updated if the output
* buffer needed to be expanded. The output buffer will be null terminated.
* Returns 0 on success, -1 on error. Does not report errors to the user.
*/
int appendText(char **ppBuf, int *pnPos, int *pnSize, char *pSrc, int nToCopy)
{
char *pBuf = *ppBuf; /* output buffer */
int nPos = *pnPos; /* current offset into pBuf */
int nSize = *pnSize; /* current size of pBuf */
while (nPos + nToCopy >= nSize) {
/* Not enough space, double size of output buffer. Note we use
* >= not > so that we have enough space for the NULL character
* in the output buffer */
char *pBufNew;
pBufNew = realloc(pBuf, nSize * 2);
if (!pBufNew)
return -1;
nSize *= 2;
/* Update the max size and buffer pointer */
*pnSize = nSize;
*ppBuf = pBuf = pBufNew;
}
/* Ok, now we have enough space, copy the stuff */
strncpy(pBuf+nPos, pSrc, nToCopy);
nPos += nToCopy;
*pnPos = nPos; /* update current position */
pBuf[nPos] = '\0'; /* append trailing NULL */
return 0;
}
/*
* Expand all the sequences in an input line. Returns a pointer to the
* expanded line. The caller should free the returned data.
* The replaceTable argument is a table of sequences to expand.
*
* Returns NULL on error. Does not report errors to the user.
*/
char *expandLine(char *in, REPLACETABLE replaceTable)
{
REPLACEITEM *item;
char *pos; /* current position in input buffer */
char *outbuf; /* output buffer */
int outbuf_size; /* current size of output buffer */
int outbuf_position; /* current position in output buffer */
char *start; /* position to copy from in input buffer */
/* Create an initial output buffer. Guess that twice the input size
* is a good length, after expansion. Don't worry if we need more
* though, appendText() will expand as needed.
*/
outbuf_size = strlen(in) * 2;
outbuf_position = 0;
outbuf = malloc(outbuf_size);
if (!outbuf)
return NULL;
start = in; /* mark the start of uncopied data */
pos = in; /* current position in input buffer */
while (1) {
/* Look for '@@' sequence, or end of input */
if (*pos && !(*pos == '@' && *(pos+1) == '@')) {
pos++;
continue;
}
if (!*pos) {
/* End of input string, copy the uncopied data */
if (appendText(&outbuf, &outbuf_position, &outbuf_size,
start, pos-start) < 0) {
return NULL;
}
break;
}
/* Found first @ of a possible token to replace. Look for end
* of the token
*/
for (item = replaceTable; item->tmpl; ++item) {
if (!strncmp(pos, item->tmpl, strlen(item->tmpl)))
break;
}
if (item->tmpl) {
/* Found match. First copy the uncopied data from the input
* buffer (start through to pos-1), then copy the expanded
* value. */
if (appendText(&outbuf, &outbuf_position, &outbuf_size,
start, pos-start) < 0) {
return NULL;
}
if (appendText(&outbuf, &outbuf_position, &outbuf_size,
item->value, strlen(item->value)) < 0) {
return NULL;
}
/* Update current position to skip over the input buffer
* @@...@@ sequence, and update the "start" pointer to uncopied
* data
*/
pos += strlen(item->tmpl);
start = pos;
}
else {
/* The sequence did not exist in the replace table, so copy
* it as-is to the output.
*/
pos++;
}
}
return outbuf;
}
/*
* Copy a file, expanding sequences from the replaceTable argument.
* Returns 0 on success, -1 on error. Reports errors to user.
*/
#define MAX_INPUT_LINE 2000
int WINAPI ExpandConfFile(HWND hwnd, LPSTR szInst, LPSTR szinFile, LPSTR
szoutFile, REPLACETABLE replaceTable)
{
char inFile[_MAX_PATH];
char outFile[_MAX_PATH];
char inbuf[MAX_INPUT_LINE];
FILE *infp;
FILE *outfp;
sprintf(inFile, "%s\\%s", szInst, szinFile);
sprintf(outFile, "%s\\%s", szInst, szoutFile);
if (!(infp = fopen(inFile, "r"))) {
MessageBox_error(hwnd,
AP_WIN32ERROR,
"Installation Problem",
MB_OK | MB_ICONSTOP,
"Cannot read file %s", inFile);
return -1;
}
if (!(outfp = fopen(outFile, "w"))) {
MessageBox_error(hwnd,
AP_WIN32ERROR,
"Installation Problem",
MB_OK | MB_ICONSTOP,
"Cannot write to file %s", outFile);
fclose(infp);
return -1;
}
while (fgets(inbuf, MAX_INPUT_LINE, infp)) {
char *pos;
char *outbuf;
/* Quickly look to see if this line contains any
* @@ tokens. If it doesn't, we don't need to bother
* called expandLine() or taking a copy of the input
* buffer.
*/
for (pos = inbuf; *pos; ++pos)
if (*pos == '@' && *(pos+1) == '@')
break;
if (*pos) {
/* The input line contains at least one '@@' sequence, so
* call expandLine() to expand any sequences we know about.
*/
outbuf = expandLine(inbuf, replaceTable);
if (outbuf == NULL) {
fclose(infp);
fclose(outfp);
MessageBox_error(hwnd,
0,
"Installation Problem",
MB_OK|MB_ICONSTOP,
"An error occurred during installation");
return -1;
}
}
else {
outbuf = NULL;
}
/* If outbuf is NULL, we did not need to expand sequences, so
* just output the contents of the input buffer.
*/
fwrite(outbuf ? outbuf : inbuf, 1,
strlen(outbuf ? outbuf : inbuf), outfp);
if (outbuf)
free(outbuf);
}
fclose(infp);
fclose(outfp);
return 0;
}
int FillInReplaceTable(HWND hwnd, REPLACETABLE table, char *szInst)
{
REPLACEITEM *item;
for (item = table; item->tmpl; ++item) {
if (!strcmp(item->tmpl, "@@ServerRoot@@")) {
char *p;
#if NEED_SHORT_PATHS
int len;
len = GetShortPathName(szInst, NULL, 0);
if (len > 0) {
item->value = (char*)malloc(len+1);
GetShortPathName(szInst, item->value, len);
}
#else
if ((item->value = strdup(szInst)) == NULL)
return -1;
#endif
for (p = item->value; *p; p++)
if (*p == '\\') *p = '/';
continue;
}
#if NEED_FQDN
if (!strcmp(item->tmpl, "FQDN")) {
item->value = GetHostName(hwnd);
continue;
}
#endif
}
return 0;
}
/*
* This is the entry point from InstallShield. The only parameter
* of interest is szInst which gives the installation directory. The
* template configuration files will be in the files
* conf\httpd.conf-dist-win, conf\access.conf-dist-win and
* conf\srm.conf-dist-win relative to this directory. We need to
* expand them into corresponding conf\*.conf files.
*
* Return 1 on success, 0 on error.
*/
typedef struct {
char *in;
char *out;
} FILEITEM;
typedef FILEITEM *FILETABLE;
FILEITEM fileTable[] = {
{ "conf\\httpd.conf-dist-win", "conf\\httpd.conf" },
{ "conf\\srm.conf-dist-win", "conf\\srm.conf" },
{ "conf\\access.conf-dist-win", "conf\\access.conf" },
{ NULL, NULL }
};
/*
* BeforeExit() is the DLL call from InstallShield. The arguments and
* return value as defined by the installer. We are only interested
* in the install directory, szInst. Return 0 on error and 1 on
* success (!?).
*/
CHAR WINAPI BeforeExit(HWND hwnd, LPSTR szSrcDir, LPSTR szSupport, LPSTR
szInst, LPSTR szRes)
{
FILEITEM *pfileItem;
FillInReplaceTable(hwnd, replaceHttpd, szInst);
pfileItem = fileTable;
while (pfileItem->in != NULL) {
if (ExpandConfFile(hwnd, szInst,
pfileItem->in, pfileItem->out,
replaceHttpd) < 0) {
/* Error has already been reported to the user */
return 0;
}
pfileItem++;
}
return 1;
}
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
hInstance = hInstDLL;
return TRUE;
}
1.1 apache-1.3/src/os/win32/installer/installdll/install.def
Index: install.def
===================================================================
LIBRARY INSTALL
DESCRIPTION 'Installer DLL For Apache'
EXPORTS
BeforeExit @1
DllMain @2
1.1 apache-1.3/src/os/win32/installer/installdll/install.dsp
Index: install.dsp
===================================================================
# Microsoft Developer Studio Project File - Name="install" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=install - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "install.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "install.mak" CFG="install - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "install - Win32 Release" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE "install - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "install - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"
/YX /FD /c
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX
/FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:windows /dll
/machine:I386
!ELSEIF "$(CFG)" == "install - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D
"_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D
"_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:windows /dll /debug
/machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "install - Win32 Release"
# Name "install - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\install.c
# End Source File
# Begin Source File
SOURCE=.\install.def
# End Source File
# End Group
# End Target
# End Project
1.1 apache-1.3/src/os/win32/installer/installdll/install.mak
Index: install.mak
===================================================================
# Microsoft Developer Studio Generated NMAKE File, Based on install.dsp
!IF "$(CFG)" == ""
CFG=install - Win32 Debug
!MESSAGE No configuration specified. Defaulting to install - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "install - Win32 Release" && "$(CFG)" !=\
"install - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "install.mak" CFG="install - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "install - Win32 Release" (based on\
"Win32 (x86) Dynamic-Link Library")
!MESSAGE "install - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "install - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\install.dll"
!ELSE
ALL : "$(OUTDIR)\install.dll"
!ENDIF
CLEAN :
[EMAIL PROTECTED] "$(INTDIR)\install.obj"
[EMAIL PROTECTED] "$(INTDIR)\vc50.idb"
[EMAIL PROTECTED] "$(OUTDIR)\install.dll"
[EMAIL PROTECTED] "$(OUTDIR)\install.exp"
[EMAIL PROTECTED] "$(OUTDIR)\install.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)\install.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\install.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:windows /dll\
/incremental:no /pdb:"$(OUTDIR)\install.pdb" /machine:I386
/def:".\install.def"\
/out:"$(OUTDIR)\install.dll" /implib:"$(OUTDIR)\install.lib"
DEF_FILE= \
".\install.def"
LINK32_OBJS= \
"$(INTDIR)\install.obj"
"$(OUTDIR)\install.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "install - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\install.dll"
!ELSE
ALL : "$(OUTDIR)\install.dll"
!ENDIF
CLEAN :
[EMAIL PROTECTED] "$(INTDIR)\install.obj"
[EMAIL PROTECTED] "$(INTDIR)\vc50.idb"
[EMAIL PROTECTED] "$(INTDIR)\vc50.pdb"
[EMAIL PROTECTED] "$(OUTDIR)\install.dll"
[EMAIL PROTECTED] "$(OUTDIR)\install.exp"
[EMAIL PROTECTED] "$(OUTDIR)\install.ilk"
[EMAIL PROTECTED] "$(OUTDIR)\install.lib"
[EMAIL PROTECTED] "$(OUTDIR)\install.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D
"_WINDOWS"\
/Fp"$(INTDIR)\install.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Debug/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
RSC=rc.exe
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\install.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
advapi32.lib shell32.lib wsock32.lib /nologo /subsystem:windows /dll\
/incremental:yes /pdb:"$(OUTDIR)\install.pdb" /debug /machine:I386\
/def:".\install.def" /out:"$(OUTDIR)\install.dll"\
/implib:"$(OUTDIR)\install.lib" /pdbtype:sept
DEF_FILE= \
".\install.def"
LINK32_OBJS= \
"$(INTDIR)\install.obj"
"$(OUTDIR)\install.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(CFG)" == "install - Win32 Release" || "$(CFG)" ==\
"install - Win32 Debug"
SOURCE=.\install.c
"$(INTDIR)\install.obj" : $(SOURCE) "$(INTDIR)"
!ENDIF
1.1
apache-1.3/src/os/win32/installer/installdll/test/resource.h
Index: resource.h
===================================================================
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by test.rc
//
#define IDM_TEST 102
#define IDI_TEST 106
#define IDD_ABOUT 107
#define IDM_BEFOREEXIT 40001
#define IDM_EXIT 106
#define IDM_ABOUT 303
#define IDC_STATIC -1
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 109
#define _APS_NEXT_COMMAND_VALUE 40002
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
1.1 apache-1.3/src/os/win32/installer/installdll/test/test.c
Index: test.c
===================================================================
/*
* Tester for the Apache Install DLL
*/
#include <windows.h>
#include "test.h"
#define APPNAME "Test"
HINSTANCE hInst; // current instance
char szAppName[100]; // Name of the app
char szTitle[100]; // The title bar text
extern CHAR WINAPI BeforeExit(HWND, LPSTR,LPSTR,LPSTR,LPSTR);
BOOL InitApplication(HINSTANCE);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
MSG msg;
HANDLE hAccelTable;
lstrcpy (szAppName, APPNAME);
lstrcpy (szTitle, APPNAME);
if (!hPrevInstance) {
if (!InitApplication(hInstance)) {
return (FALSE);
}
}
if (!InitInstance(hInstance, nCmdShow)) {
return (FALSE);
}
hAccelTable = LoadAccelerators (hInstance, szAppName);
while (GetMessage(&msg, NULL, 0, 0)) {
if (!TranslateAccelerator (msg.hwnd, hAccelTable, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (msg.wParam);
lpCmdLine; // This will prevent 'unused formal parameter' warnings
}
BOOL InitApplication(HINSTANCE hInstance)
{
WNDCLASS wc;
HWND hwnd;
hwnd = FindWindow (szAppName, szTitle);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = (WNDPROC)WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE(IDI_TEST));
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName = MAKEINTRESOURCE(IDM_TEST);
wc.lpszClassName = szAppName;
return RegisterClass(&wc);
}
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
HWND hWnd;
hInst = hInstance;
hWnd = CreateWindow(szAppName, szTitle, WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0,
NULL, NULL, hInstance, NULL);
if (!hWnd) {
return (FALSE);
}
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
return (TRUE);
}
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM
lParam)
{
int wmId, wmEvent;
switch (message) {
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
switch (wmId) {
case IDM_ABOUT:
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), hWnd,
(DLGPROC)About);
break;
case IDM_BEFOREEXIT:
BeforeExit(hWnd, "C:\\", "C:\\", "C:\\Apache", NULL);
break;
case IDM_EXIT:
DestroyWindow (hWnd);
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
break;
case WM_DESTROY:
PostQuitMessage(0);
break;
default:
return (DefWindowProc(hWnd, message, wParam, lParam));
}
return (0);
}
LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) {
case WM_INITDIALOG:
return (TRUE);
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
EndDialog(hDlg, TRUE);
return (TRUE);
}
break;
}
return FALSE;
}
1.1
apache-1.3/src/os/win32/installer/installdll/test/test.def
Index: test.def
===================================================================
NAME Test
DESCRIPTION 'Test Installer DLL'
1.1
apache-1.3/src/os/win32/installer/installdll/test/test.dsp
Index: test.dsp
===================================================================
# Microsoft Developer Studio Project File - Name="test" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=test - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "test.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "test.mak" CFG="test - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "test - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "test - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "test - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX
/FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "NDEBUG"
# ADD RSC /l 0x809 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib /nologo /subsystem:windows /machine:I386
# ADD LINK32 ..\Release\install.lib kernel32.lib user32.lib gdi32.lib
winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo /subsystem:windows
/machine:I386
!ELSEIF "$(CFG)" == "test - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D
"_WINDOWS" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS"
/YX /FD /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD BASE RSC /l 0x809 /d "_DEBUG"
# ADD RSC /l 0x809 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib
advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib
odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 ..\Debug\install.lib wsock32.lib kernel32.lib user32.lib
gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo
/subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "test - Win32 Release"
# Name "test - Win32 Debug"
# Begin Source File
SOURCE=.\resource.h
# End Source File
# Begin Source File
SOURCE=.\test.c
# End Source File
# Begin Source File
SOURCE=.\test.def
# End Source File
# Begin Source File
SOURCE=.\test.h
# End Source File
# Begin Source File
SOURCE=.\test.ico
# End Source File
# Begin Source File
SOURCE=.\test.rc
!IF "$(CFG)" == "test - Win32 Release"
!ELSEIF "$(CFG)" == "test - Win32 Debug"
!ENDIF
# End Source File
# End Target
# End Project
1.1 apache-1.3/src/os/win32/installer/installdll/test/test.h
Index: test.h
===================================================================
#include "resource.h"
1.1
apache-1.3/src/os/win32/installer/installdll/test/test.ico
Index: test.ico
===================================================================
1.1
apache-1.3/src/os/win32/installer/installdll/test/test.mak
Index: test.mak
===================================================================
# Microsoft Developer Studio Generated NMAKE File, Based on test.dsp
!IF "$(CFG)" == ""
CFG=test - Win32 Debug
!MESSAGE No configuration specified. Defaulting to test - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "test - Win32 Release" && "$(CFG)" != "test - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "test.mak" CFG="test - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "test - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "test - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "test - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\test.exe"
!ELSE
ALL : "$(OUTDIR)\test.exe"
!ENDIF
CLEAN :
[EMAIL PROTECTED] "$(INTDIR)\test.obj"
[EMAIL PROTECTED] "$(INTDIR)\test.res"
[EMAIL PROTECTED] "$(INTDIR)\vc50.idb"
[EMAIL PROTECTED] "$(OUTDIR)\test.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
/Fp"$(INTDIR)\test.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
RSC=rc.exe
RSC_PROJ=/l 0x809 /fo"$(INTDIR)\test.res" /d "NDEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\test.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=..\Release\install.lib kernel32.lib user32.lib gdi32.lib\
winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo
/subsystem:windows\
/incremental:no /pdb:"$(OUTDIR)\test.pdb" /machine:I386 /def:".\test.def"\
/out:"$(OUTDIR)\test.exe"
DEF_FILE= \
".\test.def"
LINK32_OBJS= \
"$(INTDIR)\test.obj" \
"$(INTDIR)\test.res"
"$(OUTDIR)\test.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "test - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
!IF "$(RECURSE)" == "0"
ALL : "$(OUTDIR)\test.exe"
!ELSE
ALL : "$(OUTDIR)\test.exe"
!ENDIF
CLEAN :
[EMAIL PROTECTED] "$(INTDIR)\test.obj"
[EMAIL PROTECTED] "$(INTDIR)\test.res"
[EMAIL PROTECTED] "$(INTDIR)\vc50.idb"
[EMAIL PROTECTED] "$(INTDIR)\vc50.pdb"
[EMAIL PROTECTED] "$(OUTDIR)\test.exe"
[EMAIL PROTECTED] "$(OUTDIR)\test.ilk"
[EMAIL PROTECTED] "$(OUTDIR)\test.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MLd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D
"_WINDOWS"\
/Fp"$(INTDIR)\test.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Debug/
CPP_SBRS=.
.c{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_OBJS)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(CPP_SBRS)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
RSC=rc.exe
RSC_PROJ=/l 0x809 /fo"$(INTDIR)\test.res" /d "_DEBUG"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\test.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=..\Debug\install.lib wsock32.lib kernel32.lib user32.lib
gdi32.lib\
winspool.lib comdlg32.lib advapi32.lib shell32.lib /nologo
/subsystem:windows\
/incremental:yes /pdb:"$(OUTDIR)\test.pdb" /debug /machine:I386\
/def:".\test.def" /out:"$(OUTDIR)\test.exe" /pdbtype:sept
DEF_FILE= \
".\test.def"
LINK32_OBJS= \
"$(INTDIR)\test.obj" \
"$(INTDIR)\test.res"
"$(OUTDIR)\test.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(CFG)" == "test - Win32 Release" || "$(CFG)" == "test - Win32 Debug"
SOURCE=.\test.c
!IF "$(CFG)" == "test - Win32 Release"
"$(INTDIR)\test.obj" : $(SOURCE) "$(INTDIR)"
!ELSEIF "$(CFG)" == "test - Win32 Debug"
DEP_CPP_TEST_=\
".\test.h"\
"$(INTDIR)\test.obj" : $(SOURCE) $(DEP_CPP_TEST_) "$(INTDIR)"
!ENDIF
SOURCE=.\test.rc
DEP_RSC_TEST_R=\
".\test.h"\
".\test.ico"\
"$(INTDIR)\test.res" : $(SOURCE) $(DEP_RSC_TEST_R) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
!ENDIF
1.1 apache-1.3/src/os/win32/installer/installdll/test/test.rc
Index: test.rc
===================================================================
//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
#include "test.h"
#include "winver.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.K.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK
#pragma code_page(1252)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
IDI_TEST ICON DISCARDABLE "test.ico"
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
IDM_TEST MENU DISCARDABLE
BEGIN
POPUP "&File"
BEGIN
MENUITEM "E&xit", IDM_EXIT
END
POPUP "&Test"
BEGIN
MENUITEM "Call &BeforeExit", IDM_BEFOREEXIT
END
POPUP "&Help"
BEGIN
MENUITEM "&About", IDM_ABOUT
END
END
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""test.h""\r\n"
"#include ""winver.h""\r\n"
"\0"
END
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//
IDD_ABOUT DIALOG DISCARDABLE 0, 0, 186, 47
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,129,26,50,14
LTEXT "Apache Install DLL Tester",IDC_STATIC,7,7,172,14,NOT
WS_GROUP
END
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
IDD_ABOUT, DIALOG
BEGIN
LEFTMARGIN, 7
RIGHTMARGIN, 179
TOPMARGIN, 7
BOTTOMMARGIN, 40
END
END
#endif // APSTUDIO_INVOKED
#endif // English (U.K.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED