Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. psxss.c
  5. Abstract:
  6. This is the main startup module for the POSIX Emulation Subsystem Server
  7. Author:
  8. Steve Wood (stevewo) 22-Aug-1989
  9. Environment:
  10. User Mode Only
  11. Revision History:
  12. --*/
  13. #include "psxsrv.h"
  14. #include "sesport.h"
  15. #if DBG
  16. ULONG PsxDebug = 0;
  17. #endif //DBG
  18. extern NTSTATUS PsxServerInitialization(VOID);
  19. int
  20. __cdecl
  21. main(
  22. int argc,
  23. char *argv[]
  24. )
  25. {
  26. OBJECT_ATTRIBUTES ObjectAttributes;
  27. UNICODE_STRING DirectoryName_U;
  28. CHAR localSecurityDescriptor[SECURITY_DESCRIPTOR_MIN_LENGTH];
  29. PSECURITY_DESCRIPTOR securityDescriptor;
  30. NTSTATUS Status;
  31. UNREFERENCED_PARAMETER(argc);
  32. UNREFERENCED_PARAMETER(argv);
  33. //
  34. // Create a root directory in the object name space that will be used
  35. // to contain all of the named objects created by the POSIX Emulation
  36. // subsystem.
  37. //
  38. PSX_GET_SESSION_OBJECT_NAME(&DirectoryName_U, PSX_SS_ROOT_OBJECT_DIRECTORY);
  39. Status = PsxCreateDirectoryObject (&DirectoryName_U);
  40. if (!NT_SUCCESS(Status)) {
  41. IF_DEBUG {
  42. KdPrint(("PSXSS: Unable to initialize server; Status == %X\n",
  43. Status));
  44. }
  45. goto out;
  46. }
  47. //
  48. // Initialize the PSX Server Session Manager API Port, the listen thread
  49. // one request thread.
  50. //
  51. Status = PsxSbApiPortInitialize();
  52. ASSERT(NT_SUCCESS(Status));
  53. //
  54. // Connect to the session manager so we can start foreign sessions
  55. //
  56. Status = SmConnectToSm(&PsxSbApiPortName_U,
  57. PsxSbApiPort,
  58. IMAGE_SUBSYSTEM_POSIX_CUI,
  59. &PsxSmApiPort);
  60. ASSERT(NT_SUCCESS(Status));
  61. Status = PsxServerInitialization();
  62. if (!NT_SUCCESS(Status)) {
  63. IF_PSX_DEBUG(INIT) {
  64. KdPrint(("PSXSS: Unable to initialize; Status = %X\n", Status));
  65. }
  66. NtTerminateProcess(NtCurrentProcess(), Status);
  67. }
  68. out:
  69. NtTerminateThread(NtCurrentThread(), STATUS_SUCCESS);
  70. return 0;
  71. }