source: trunk/src/win32k/ldr/mytkStartProcess.asm@ 4164

Last change on this file since 4164 was 4164, checked in by bird, 25 years ago

Merged in the Grace branch. New Win32k!

File size: 2.8 KB
Line 
1; $Id: mytkStartProcess.asm,v 1.2 2000-09-02 21:08:10 bird Exp $
2;
3; tkStartProcess overloader. Needed to clear the loader semaphore
4; when a process is being started syncronously.
5;
6; Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
7;
8; Project Odin Software License can be found in LICENSE.TXT
9;
10
11 .386p
12
13
14;
15; Include files
16;
17 include devsegdf.inc
18
19;
20; Imported Functions and variables.
21;
22
23 ;
24 ; LDR semaphore
25 ;
26 extrn pLdrSem:DWORD
27 extrn _LDRClearSem@0:PROC
28 extrn _KSEMRequestMutex@8:PROC
29 extrn _KSEMQueryMutex@8:PROC
30
31 ;
32 ; Loader State
33 ;
34 extrn ulLDRState:DWORD
35
36 ;
37 ; mytkExecPgm stuff.
38 ;
39 extrn fTkExecPgm:BYTE
40
41 ;
42 ; Pointer to current executable module.
43 ;
44 extrn pExeModule:DWORD
45
46 ;
47 ; TKSSBase (32-bit)
48 ;
49 extrn pulTKSSBase32:DWORD
50
51 ;
52 ; Calltable entry for tkStartProcess
53 ;
54 extrn _tkStartProcess:PROC
55
56;
57; Exported symbols
58;
59 public mytkStartProcess
60
61
62CODE32 SEGMENT
63
64;;
65; Overloads tkStartProcess. If the loader semahore is taken by us we'll release it.
66; @returns
67; @param
68; @uses eax, ecx, edx
69; @sketch
70; @status
71; @author knut st. osmundsen (knut.stange.osmundsen@pmsc.no)
72; @remark
73mytkStartProcess PROC NEAR
74 ASSUME DS:FLAT, ES:NOTHING, SS:NOTHING
75
76 ;
77 ; Check if the loader semphore is take by us.
78 ; Clear it (and other vars) if it is.
79 ;
80 push eax
81 push ecx
82 push edx
83
84 push 0 ; Usage count variable.
85 mov eax, pulTKSSBase32 ; Get TKSSBase
86 mov eax, [eax]
87 add eax, esp ; Added TKSSBase to the usage count pointer
88 push eax ; Push address of usage count pointer.
89 push pLdrSem ; Push pointer to loader semaphore ( = handle).
90 call near ptr FLAT:_KSEMQueryMutex@8
91 or eax, eax ; Check return code. (1 = our / free; 0 = not our but take)
92 pop eax ; Pops usage count.
93 jz mtksp_ret ; jmp if not taken by us (rc=FALSE).
94 or eax, eax ; Check usage count.
95 jz mtksp_ret ; jmp if 0 (=free).
96 mov ulLDRState, 0 ; Clears loaderstate. (LDRSTATE_UNKNOWN)
97 mov pExeModule, 0 ; Sets the exemodule pointer to NULL.
98 mov fTkExecPgm, 0 ; Marks global data invalid.
99 cmp eax, 2 ; If usage count > 1 then issue a release. (should not happen here)
100 jl mtksp_ret ; jmp if usage count < 2. (tkStartProcess or tkExecPgm will free the last usage).
101 call near ptr FLAT:_LDRClearSem@0
102
103mtksp_ret:
104 pop edx
105 pop ecx
106 pop eax
107 jmp near ptr FLAT:_tkStartProcess
108mytkStartProcess ENDP
109
110CODE32 ENDS
111END
Note: See TracBrowser for help on using the repository browser.