~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/programs/rpcss/rpcss_main.c

Version: ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~ [ wine-1.0-rc5 ] ~ [ wine-1.0-rc4 ] ~ [ wine-1.0-rc3 ] ~ [ wine-1.0-rc2 ] ~ [ wine-1.0-rc1 ] ~ [ wine-0.9.61 ] ~ [ wine-0.9.60 ] ~ [ wine-0.9.59 ] ~ [ wine-0.9.58 ] ~ [ wine-0.9.57 ] ~ [ wine-0.9.56 ] ~ [ wine-0.9.55 ] ~ [ wine-0.9.54 ] ~ [ wine-0.9.53 ] ~ [ wine-0.9.52 ] ~ [ wine-0.9.51 ] ~ [ wine-0.9.50 ] ~ [ wine-0.9.49 ] ~ [ wine-0.9.48 ] ~ [ wine-0.9.47 ] ~ [ wine-0.9.46 ] ~ [ wine-0.9.45 ] ~ [ wine-0.9.44 ] ~ [ wine-0.9.43 ] ~ [ wine-0.9.42 ] ~ [ wine-0.9.41 ] ~ [ wine-0.9.40 ] ~ [ wine-0.9.39 ] ~ [ wine-0.9.38 ] ~ [ wine-0.9.37 ] ~ [ wine-0.9.36 ] ~ [ wine-0.9.35 ] ~ [ wine-0.9.34 ] ~ [ wine-0.9.33 ] ~ [ wine-0.9.32 ] ~ [ wine-0.9.31 ] ~ [ wine-0.9.30 ] ~ [ wine-0.9.29 ] ~ [ wine-0.9.28 ] ~ [ wine-0.9.27 ] ~ [ wine-0.9.26 ] ~ [ wine-0.9.25 ] ~ [ wine-0.9.24 ] ~ [ wine-0.9.23 ] ~ [ wine-0.9.22 ] ~ [ wine-0.9.21 ] ~ [ wine-0.9.20 ] ~ [ wine-0.9.19 ] ~ [ wine-0.9.18 ] ~ [ wine-0.9.17 ] ~ [ wine-0.9.16 ] ~ [ wine-0.9.15 ] ~ [ wine-0.9.14 ] ~ [ wine-0.9.13 ] ~ [ wine-0.9.12 ] ~ [ wine-0.9.11 ] ~ [ wine-0.9.10 ] ~ [ wine-0.9.9 ] ~ [ wine-0.9.8 ] ~ [ wine-0.9.7 ] ~ [ wine-0.9.6 ] ~ [ wine-0.9.5 ] ~ [ wine-0.9.4 ] ~ [ wine-0.9.3 ] ~ [ wine-0.9.2 ] ~ [ wine-0.9.1 ] ~ [ wine-0.9 ] ~ [ wine20050930 ] ~ [ wine20050830 ] ~ [ wine20050725 ] ~ [ wine20050628 ] ~ [ wine20050524 ] ~ [ wine20050419 ] ~ [ wine20050310 ] ~ [ wine20050211 ] ~ [ wine20050111 ] ~ [ wine20041201 ] ~ [ wine20041019 ] ~ [ wine20040914 ] ~ [ wine20040813 ] ~ [ wine20040716 ] ~ [ wine20040615 ] ~ [ wine20040505 ] ~ [ wine20040408 ] ~ [ wine20040309 ] ~ [ wine20040213 ] ~ [ wine20040121 ] ~ [ wine20031212 ] ~ [ wine20031118 ] ~ [ wine20031016 ] ~ [ wine20030911 ] ~ [ wine20030813 ] ~ [ wine20030709 ] ~ [ wine20030618 ] ~ [ wine20030508 ] ~ [ wine20030408 ] ~ [ wine20030318 ] ~ [ wine20030219 ] ~ [ wine20030115 ] ~ [ wine20021219 ] ~ [ wine20021125 ] ~ [ wine20021031 ] ~ [ wine20021007 ] ~ [ wine20020904 ] ~ [ wine20020804 ] ~ [ wine20020710 ] ~ [ wine20020605 ] ~ [ wine20020509 ] ~ [ wine20020411 ] ~ [ wine20020310 ] ~ [ wine20020228 ] ~ [ wine20011226 ] ~ [ wine20011108 ] ~ [ wine20011004 ] ~ [ wine20010824 ] ~ [ wine20010731 ] ~ [ wine20010629 ] ~ [ wine20010510 ] ~ [ wine20010418 ] ~ [ wine20010326 ] ~ [ wine20010305 ] ~ [ wine20010216 ] ~ [ wine20010112 ] ~ [ wine20001222 ] ~ [ wine20001202 ] ~ [ wine20001026 ] ~ [ wine20001002 ] ~ [ wine20000909 ] ~ [ wine20000821 ] ~ [ wine20000801 ] ~ [ wine20000716 ] ~ [ wine20000326 ] ~ [ wine20000227 ] ~ [ wine20000130 ] ~ [ wine20000109 ] ~

  1 /*
  2  * Copyright 2001, Ove Kåven, TransGaming Technologies Inc.
  3  * Copyright 2002 Greg Turner
  4  *
  5  * This library is free software; you can redistribute it and/or
  6  * modify it under the terms of the GNU Lesser General Public
  7  * License as published by the Free Software Foundation; either
  8  * version 2.1 of the License, or (at your option) any later version.
  9  *
 10  * This library is distributed in the hope that it will be useful,
 11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13  * Lesser General Public License for more details.
 14  *
 15  * You should have received a copy of the GNU Lesser General Public
 16  * License along with this library; if not, write to the Free Software
 17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 18  *
 19  * ---- rpcss_main.c:
 20  *   Initialize and start serving requests.  Bail if rpcss already is
 21  *   running.
 22  *
 23  * ---- RPCSS.EXE:
 24  *   
 25  *   Wine needs a server whose role is somewhat like that
 26  *   of rpcss.exe in windows.  This is not a clone of
 27  *   windows rpcss at all.  It has been given the same name, however,
 28  *   to provide for the possibility that at some point in the future, 
 29  *   it may become interface compatible with the "real" rpcss.exe on
 30  *   Windows.
 31  *
 32  * ---- KNOWN BUGS / TODO:
 33  *
 34  *   o Service hooks are unimplemented (if you bother to implement
 35  *     these, also implement net.exe, at least for "net start" and
 36  *     "net stop" (should be pretty easy I guess, assuming the rest
 37  *     of the services API infrastructure works.
 38  *
 39  *   o There is a looming problem regarding listening on privileged
 40  *     ports.  We will need to be able to coexist with SAMBA, and be able
 41  *     to function without running winelib code as root.  This may
 42  *     take some doing, including significant reconceptualization of the
 43  *     role of rpcss.exe in wine.
 44  */
 45 
 46 #include <stdio.h>
 47 #include <limits.h>
 48 #include <assert.h>
 49 
 50 #define NONAMELESSUNION
 51 #define NONAMELESSSTRUCT
 52 #include "rpcss.h"
 53 #include "winnt.h"
 54 #include "irot.h"
 55 #include "epm.h"
 56 
 57 #include "wine/debug.h"
 58 
 59 WINE_DEFAULT_DEBUG_CHANNEL(ole);
 60 
 61 static HANDLE exit_event;
 62 
 63 extern HANDLE __wine_make_process_system(void);
 64 
 65 static BOOL RPCSS_Initialize(void)
 66 {
 67   static unsigned short irot_protseq[] = IROT_PROTSEQ;
 68   static unsigned short irot_endpoint[] = IROT_ENDPOINT;
 69   static unsigned short epm_protseq[] = {'n','c','a','c','n','_','n','p',0};
 70   static unsigned short epm_endpoint[] = {'\\','p','i','p','e','\\','e','p','m','a','p','p','e','r',0};
 71   static unsigned short epm_protseq_lrpc[] = {'n','c','a','l','r','p','c',0};
 72   static unsigned short epm_endpoint_lrpc[] = {'e','p','m','a','p','p','e','r',0};
 73   RPC_STATUS status;
 74 
 75   WINE_TRACE("\n");
 76 
 77   status = RpcServerRegisterIf(epm_v3_0_s_ifspec, NULL, NULL);
 78   if (status != RPC_S_OK)
 79     return status;
 80   status = RpcServerRegisterIf(Irot_v0_2_s_ifspec, NULL, NULL);
 81   if (status != RPC_S_OK)
 82   {
 83     RpcServerUnregisterIf(epm_v3_0_s_ifspec, NULL, FALSE);
 84     return FALSE;
 85   }
 86 
 87   status = RpcServerUseProtseqEpW(epm_protseq, RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
 88                                   epm_endpoint, NULL);
 89   if (status != RPC_S_OK)
 90     goto fail;
 91 
 92   status = RpcServerUseProtseqEpW(epm_protseq_lrpc, RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
 93                                   epm_endpoint_lrpc, NULL);
 94   if (status != RPC_S_OK)
 95       goto fail;
 96 
 97   status = RpcServerUseProtseqEpW(irot_protseq, RPC_C_PROTSEQ_MAX_REQS_DEFAULT,
 98                                   irot_endpoint, NULL);
 99   if (status != RPC_S_OK)
100     goto fail;
101 
102   status = RpcServerListen(1, RPC_C_LISTEN_MAX_CALLS_DEFAULT, TRUE);
103   if (status != RPC_S_OK)
104     goto fail;
105 
106   exit_event = __wine_make_process_system();
107 
108   return TRUE;
109 
110 fail:
111   RpcServerUnregisterIf(epm_v3_0_s_ifspec, NULL, FALSE);
112   RpcServerUnregisterIf(Irot_v0_2_s_ifspec, NULL, FALSE);
113   return FALSE;
114 }
115 
116 /* returns false if we discover at the last moment that we
117    aren't ready to terminate */
118 static BOOL RPCSS_Shutdown(void)
119 {
120   RpcMgmtStopServerListening(NULL);
121   RpcServerUnregisterIf(epm_v3_0_s_ifspec, NULL, TRUE);
122   RpcServerUnregisterIf(Irot_v0_2_s_ifspec, NULL, TRUE);
123 
124   CloseHandle(exit_event);
125 
126   return TRUE;
127 }
128 
129 int main( int argc, char **argv )
130 {
131   /* 
132    * We are invoked as a standard executable; we act in a
133    * "lazy" manner.  We register our interfaces and endpoints, and hang around
134    * until we all user processes exit, and then silently terminate.
135    */
136 
137   if (RPCSS_Initialize()) {
138     WaitForSingleObject(exit_event, INFINITE);
139     RPCSS_Shutdown();
140   }
141 
142   return 0;
143 }
144 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.