summaryrefslogtreecommitdiffstats
path: root/private/os2/client/coninit.c
blob: b2d8f544f298eada801699cce0fb7ef8fadd7763 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*++

Copyright (c) 1989  Microsoft Corporation

Module Name:

    coninit.c

Abstract:

    This module initialize the connection with the session console port

Author:

    Avi Nathan (avin) 23-Jul-1991

Revision History:


--*/

#define INCL_OS2V20_MEMORY
#define INCL_OS2V20_ERRORS
#include "os2dll.h"
#include "os2dll16.h"

#define NTOS2_ONLY
#include "conrqust.h"

extern PVOID   Os2SessionCtrlDataBaseAddress;
extern PVOID   Os2SessionDataBaseAddress;
extern PUCHAR  LVBBuffer;
extern HANDLE  Ow2hSession;

NTSTATUS
Od2InitializeSessionPort(OUT PBOOLEAN RootProcessInSession)
{

    SesGrpId = (ULONG)Ow2hSession;

    *RootProcessInSession = (BOOLEAN)SesGrp->FirstProcess;

    if (SesGrp->FirstProcess)
    {
        SesGrp->FirstProcess = FALSE;

        //RtlInitializeResource( (PRTL_RESOURCE)SesGrp->StdHandleLock );
    }

    MoniorOpenedForThisProcess = FALSE;

    // BUGBUG! find cleanup code and close the port, or let exit cleanup

    return( 0 );
}


APIRET
OpenLVBsection()
{
    NTSTATUS        Status;
    SEL             Sel;
    I386DESCRIPTOR  Desc;


                //
                // Set A Data segment selector in the LDT
                //

    Desc.BaseAddress = (ULONG)LVBBuffer;
    Desc.Limit = SesGrp->MaxLVBsize-1;
    Desc.Type = READ_WRITE_DATA;

                //
                // Apply tiling scheme
                //
    Sel = (SEL)FLATTOSEL((Desc.BaseAddress));
                //
    Status = Nt386SetDescriptorLDT (
                NULL,
                Sel,
                Desc);
    if (!NT_SUCCESS( Status )) {
#if DBG
        DbgPrint("OpenLVB: Can't Set LDT desc Error=%lx\n", Status);
#endif
        return( ERROR_NOT_ENOUGH_MEMORY );
    }

    VioBuff = (PVOID)LVBBuffer;

    return(NO_ERROR);
}