commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r812368 - in /commons/sandbox/runtime/trunk/src/main/native: Makefile.msc.in os/win32/subproc.c os/win32/subsys.c
Date Tue, 08 Sep 2009 07:59:57 GMT
Author: mturk
Date: Tue Sep  8 07:59:56 2009
New Revision: 812368

URL: http://svn.apache.org/viewvc?rev=812368&view=rev
Log:
Add windows subproc stub

Added:
    commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c   (with props)
Modified:
    commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
    commons/sandbox/runtime/trunk/src/main/native/os/win32/subsys.c

Modified: commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in?rev=812368&r1=812367&r2=812368&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in (original)
+++ commons/sandbox/runtime/trunk/src/main/native/Makefile.msc.in Tue Sep  8 07:59:56 2009
@@ -65,6 +65,7 @@
 
 SHAREDLIB=$(LIBNAME)$(SO)
 SSLMODLIB=$(SSLNAME)$(SO)
+EXPORTS=/EXPORT:SubprocMainW
 TESTSUITE=testsuite$(EXE)
 
 COMMON_OBJS=\
@@ -117,6 +118,7 @@
 	$(SRCDIR)/os/win32/shm.$(OBJ) \
 	$(SRCDIR)/os/win32/signals.$(OBJ) \
 	$(SRCDIR)/os/win32/subsys.$(OBJ) \
+	$(SRCDIR)/os/win32/subproc.$(OBJ) \
 	$(SRCDIR)/os/win32/syslog.$(OBJ) \
 	$(SRCDIR)/os/win32/group.$(OBJ) \
 	$(SRCDIR)/os/win32/user.$(OBJ) \
@@ -203,7 +205,7 @@
 
 $(SHAREDLIB): $(PPORT_OBJS) $(COMMON_OBJS) $(@platform@_OBJS) $(REGEX_OBJS) $(BZIP2_OBJS)
$(ZLIB_OBJS) @testobjs@
 	$(RC) /l 0x409 /d "NDEBUG" /i "$(SRCDIR)\include" /fo $@.res $(SRCDIR)/os/win32/main.rc
-	$(LINK) $(SHFLAGS) $(LDFLAGS) /DLL /SUBSYSTEM:WINDOWS /pdb:$(LIBNAME).pdb /out:$@ @<<
+	$(LINK) $(SHFLAGS) $(LDFLAGS) /DLL /SUBSYSTEM:WINDOWS $(EXPORTS) /pdb:$(LIBNAME).pdb /out:$@
@<<
 	$(PPORT_OBJS) $(COMMON_OBJS) $(WINDOWS_OBJS) $(REGEX_OBJS) $(BZIP2_OBJS) $(ZLIB_OBJS) @testobjs@
$@.res
 <<
 	IF EXIST $@.manifest \

Added: commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c?rev=812368&view=auto
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c (added)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c Tue Sep  8 07:59:56 2009
@@ -0,0 +1,61 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "acr.h"
+#include "acr_private.h"
+#include "acr_arch.h"
+#include "acr_clazz.h"
+#include "acr_error.h"
+#include "acr_memory.h"
+#include "acr_port.h"
+#include "acr_string.h"
+#include "acr_tlsd.h"
+#include "acr_vm.h"
+
+#if !defined(ACR_DECLARE_EXPORT)
+/* Make sure we are exported from DLL */
+#error "Subproc cannot be compiled as part of static library
+#endif
+
+/* Subproc is a way how ACR launches external programs without flashing
+ * console or with elevated priviledges on Windows Vista and later.
+ * It also allows to create GUI applications from services running in
+ * Session zero.
+ *
+ * Our SubprocMain is invoked by Rundll32. The first argument is
+ * the hex encoded shared memory HANDLE which we duplicate and use in
+ * our new intermediate stub process. Shared memory contains all the
+ * IPC data we need.
+ */
+
+/* Rundll32 Subproc exports.
+ * Wide char version doesn't fill the CmdLine correctly
+ * (testes both with cmd and cmd /U, however I don't have Unicode system,
+ * so cannot tell for sure. However GetCommandLineW works as expected, with
+ * the exception that it returns full command line since we are now inside
+ * rundll32 process.
+ * Use _TestRun@16 for entry point.
+ * We could use the .def file or /EXPORT:FunctionName and have decorated names.
+ * Note:
+ * Rundll32 is missing console, so redirection must be performed, and it requires
+ * the short names for locating the .dll.
+ */
+__declspec(dllexport) void __stdcall SubprocMainW(HWND hwnd, HINSTANCE hinst,
+                                                  LPWSTR lpszCmdLine,
+                                                  int nCmdShow)
+{
+    /* Just a stub for now */
+}

Propchange: commons/sandbox/runtime/trunk/src/main/native/os/win32/subproc.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/subsys.c
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/subsys.c?rev=812368&r1=812367&r2=812368&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/subsys.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/subsys.c Tue Sep  8 07:59:56 2009
@@ -24,6 +24,17 @@
 #include "acr_tlsd.h"
 #include "acr_vm.h"
 
+#if !defined(ACR_DECLARE_EXPORT)
+/* Make sure we are exported from DLL */
+#error "Subsys cannot be compiled as part of static library
+#endif
+
+/* Subsys is way how ACR launches external daemons without flashing
+ * console or with elevated priviledges on Windows Vista and later.
+ * It also allows to attach the newly created process from services running in
+ * Session zero.
+ */
+
 #ifdef ACR_ENABLE_TEST
 
 /* Rundll32 Test exports.



Mime
View raw message