commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-commons-sandbox/daemon/src/native/nt/procrun procrun.vcproj procrun.h procrun.c
Date Sun, 09 Feb 2003 16:11:23 GMT
mturk       2003/02/09 08:11:23

  Modified:    daemon/src/native/nt/procrun procrun.vcproj procrun.h
                        procrun.c
  Log:
  Adde PROCRUN_WINDLL build and tree exported functions
  for use in Installation programs.
  1. InstallService  Installs the service
  2. UpdateService Sets the services param/value pair
  3. RemoveService. Deletes the service (used for uninstall)
  
  Revision  Changes    Path
  1.2       +92 -1     jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.vcproj
  
  Index: procrun.vcproj
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.vcproj,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- procrun.vcproj	7 Feb 2003 07:04:35 -0000	1.1
  +++ procrun.vcproj	9 Feb 2003 16:11:23 -0000	1.2
  @@ -33,7 +33,7 @@
   			<Tool
   				Name="VCLinkerTool"
   				AdditionalDependencies="comctl32.lib shlwapi.lib"
  -				OutputFile="$(OutDir)/procrun.exe"
  +				OutputFile="$(OutDir)/procrunw.exe"
   				LinkIncremental="2"
   				GenerateDebugInformation="TRUE"
   				ProgramDatabaseFile="$(OutDir)/procrun.pdb"
  @@ -174,6 +174,97 @@
   				LinkIncremental="1"
   				GenerateDebugInformation="TRUE"
   				SubSystem="1"
  +				OptimizeReferences="2"
  +				EnableCOMDATFolding="2"
  +				TargetMachine="1"/>
  +			<Tool
  +				Name="VCMIDLTool"/>
  +			<Tool
  +				Name="VCPostBuildEventTool"/>
  +			<Tool
  +				Name="VCPreBuildEventTool"/>
  +			<Tool
  +				Name="VCPreLinkEventTool"/>
  +			<Tool
  +				Name="VCResourceCompilerTool"/>
  +			<Tool
  +				Name="VCWebServiceProxyGeneratorTool"/>
  +			<Tool
  +				Name="VCWebDeploymentTool"/>
  +		</Configuration>
  +		<Configuration
  +			Name="DebugDLL|Win32"
  +			OutputDirectory="DebugDLL"
  +			IntermediateDirectory="DebugDLL"
  +			ConfigurationType="2"
  +			CharacterSet="2">
  +			<Tool
  +				Name="VCCLCompilerTool"
  +				Optimization="0"
  +				AdditionalIncludeDirectories="$(JAVA_HOME)\include,$(JAVA_HOME)\include\win32"
  +				PreprocessorDefinitions="_WIN32,WIN32,_DEBUG,_DEBUG_TRACE,_WINDOWS,STRICT,_WIN32_WINNT=0x0400,PROCRUN_WINDLL"
  +				MinimalRebuild="TRUE"
  +				BasicRuntimeChecks="3"
  +				RuntimeLibrary="1"
  +				UsePrecompiledHeader="0"
  +				WarningLevel="3"
  +				Detect64BitPortabilityProblems="FALSE"
  +				DebugInformationFormat="4"/>
  +			<Tool
  +				Name="VCCustomBuildTool"/>
  +			<Tool
  +				Name="VCLinkerTool"
  +				AdditionalDependencies="comctl32.lib shlwapi.lib"
  +				OutputFile="$(OutDir)/procrun.dll"
  +				LinkIncremental="2"
  +				GenerateDebugInformation="TRUE"
  +				ProgramDatabaseFile="$(OutDir)/procrun.pdb"
  +				SubSystem="2"
  +				TargetMachine="1"/>
  +			<Tool
  +				Name="VCMIDLTool"/>
  +			<Tool
  +				Name="VCPostBuildEventTool"/>
  +			<Tool
  +				Name="VCPreBuildEventTool"/>
  +			<Tool
  +				Name="VCPreLinkEventTool"/>
  +			<Tool
  +				Name="VCResourceCompilerTool"/>
  +			<Tool
  +				Name="VCWebServiceProxyGeneratorTool"/>
  +			<Tool
  +				Name="VCWebDeploymentTool"/>
  +		</Configuration>
  +		<Configuration
  +			Name="ReleaseDLL|Win32"
  +			OutputDirectory="ReleaseDLL"
  +			IntermediateDirectory="ReleaseDLL"
  +			ConfigurationType="2"
  +			CharacterSet="2">
  +			<Tool
  +				Name="VCCLCompilerTool"
  +				Optimization="2"
  +				InlineFunctionExpansion="1"
  +				OmitFramePointers="TRUE"
  +				AdditionalIncludeDirectories="$(JAVA_HOME)\include,$(JAVA_HOME)\include\win32"
  +				PreprocessorDefinitions="_WIN32,WIN32,NDEBUG,_WINDOWS,STRICT,_WIN32_WINNT=0x0400,PROCRUN_WINDLL"
  +				StringPooling="TRUE"
  +				RuntimeLibrary="0"
  +				EnableFunctionLevelLinking="TRUE"
  +				UsePrecompiledHeader="0"
  +				WarningLevel="3"
  +				Detect64BitPortabilityProblems="FALSE"
  +				DebugInformationFormat="3"/>
  +			<Tool
  +				Name="VCCustomBuildTool"/>
  +			<Tool
  +				Name="VCLinkerTool"
  +				AdditionalDependencies="comctl32.lib shlwapi.lib"
  +				OutputFile="bin/procrun.dll"
  +				LinkIncremental="1"
  +				GenerateDebugInformation="TRUE"
  +				SubSystem="2"
   				OptimizeReferences="2"
   				EnableCOMDATFolding="2"
   				TargetMachine="1"/>
  
  
  
  1.4       +2 -1      jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.h
  
  Index: procrun.h
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- procrun.h	9 Feb 2003 09:38:54 -0000	1.3
  +++ procrun.h	9 Feb 2003 16:11:23 -0000	1.4
  @@ -134,7 +134,8 @@
       enum { 
           PROCRUN_MODE_WINAPP = 1,
           PROCRUN_MODE_GUI,
  -        PROCRUN_MODE_CONSOLE
  +        PROCRUN_MODE_CONSOLE,
  +        PROCRUN_MODE_WINDLL
       };
   
       enum { 
  
  
  
  1.5       +107 -3    jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.c
  
  Index: procrun.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- procrun.c	9 Feb 2003 09:38:54 -0000	1.4
  +++ procrun.c	9 Feb 2003 16:11:23 -0000	1.5
  @@ -2208,9 +2208,12 @@
   
   static void free_environment(procrun_t *env)
   {
  -    free(env->m);
  -    free(env->c);
  -    free(env);
  +    if (env) {
  +        free(env->m);
  +        free(env->c);
  +        free(env);
  +        env = NULL;
  +    }
   }
   
   #if defined(PROCRUN_WINAPP)
  @@ -2244,6 +2247,107 @@
       procrun_main(argc, argv, _environ, env);
   
       free_environment(env);
  +}
  +#elif defined(PROCRUN_WINDLL)
  +#pragma message("Compiling DLL Application mode")
  +
  +
  +BOOL WINAPI DllMain(HINSTANCE hInst,
  +                    ULONG ulReason,
  +                    LPVOID lpReserved)
  +{ 
  +
  +    switch (ulReason) {
  +        case DLL_PROCESS_ATTACH:
  +            g_env = NULL;
  +        break;
  +        case DLL_PROCESS_DETACH:
  +            free_environment(g_env);
  +        break;
  +        default:
  +        break;
  +    } 
  +    return TRUE;     
  +}
  +
  +__declspec(dllexport) void InstallService(const char *service_name,
  +                                          const char *install,
  +                                          const char *image_path,
  +                                          const char *display_name,
  +                                          const char *description)
  +{
  +    int argc = 0;
  +    char *argv[12];
  +    char b[MAX_PATH];
  +
  +    procrun_t *env = alloc_environment();
  +    g_proc_mode = PROCRUN_MODE_WINDLL;
  +    g_env = env;
  +    
  +    argv[argc++] = "PROCRUN.DLL";
  +    strcpy(b, PROC_ARG_INSTALL_SERVICE);
  +    strcat(b, service_name);
  +    argv[argc++] = b;
  +    argv[argc++] = "--" PROCRUN_PARAMS_IMAGE;
  +    argv[argc++] = (char *)image_path;
  +    argv[argc++] = "--" PROCRUN_PARAMS_INSTALL;
  +    argv[argc++] = (char *)install;
  +    argv[argc++] = "--" PROCRUN_PARAMS_DISPLAY;
  +    argv[argc++] = (char *)display_name;
  +    argv[argc++] = "--" PROCRUN_PARAMS_DESCRIPTION;
  +    argv[argc++] = (char *)description;
  +    
  +    procrun_main(argc, argv, _environ, env);
  +
  +    free_environment(env);
  +    g_env = NULL;
  +}
  +
  +__declspec(dllexport) void UpdateService(const char *service_name,
  +                                         const char *param,
  +                                         const char *value)
  +{
  +    int argc = 0;
  +    char *argv[4];
  +    char b[MAX_PATH], p[MAX_PATH];
  +
  +    procrun_t *env = alloc_environment();
  +    g_proc_mode = PROCRUN_MODE_WINDLL;
  +    g_env = env;
  +    
  +    argv[argc++] = "PROCRUN.DLL";
  +    strcpy(b, PROC_ARG_UPDATE_SERVICE);
  +    strcat(b, service_name);
  +    strcpy(p, "--");
  +    strcat(p, param);
  +    argv[argc++] = b;
  +    argv[argc++] = p;
  +    argv[argc++] = (char *)value;
  +    
  +    procrun_main(argc, argv, _environ, env);
  +
  +    free_environment(env);
  +    g_env = NULL;
  +}
  +
  +__declspec(dllexport) void RemoveService(const char *service_name)
  +{
  +    int argc = 0;
  +    char *argv[4];
  +    char b[MAX_PATH];
  +
  +    procrun_t *env = alloc_environment();
  +    g_proc_mode = PROCRUN_MODE_WINDLL;
  +    g_env = env;
  +    
  +    argv[argc++] = "PROCRUN.DLL";
  +    strcpy(b, PROC_ARG_DELETE_SERVICE);
  +    strcat(b, service_name);
  +    argv[argc++] = b;
  +    procrun_main(argc, argv, _environ, env);
  +
  +    free_environment(env);
  +    g_env = NULL;
   }
   #else
   #error Unknown application mode
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message