Index: trunk/src/win32k/dev16/probkrnl.c
===================================================================
--- trunk/src/win32k/dev16/probkrnl.c	(revision 2846)
+++ trunk/src/win32k/dev16/probkrnl.c	(revision 2848)
@@ -1,3 +1,3 @@
-/* $Id: probkrnl.c,v 1.14 2000-02-21 09:24:00 bird Exp $
+/* $Id: probkrnl.c,v 1.15 2000-02-21 14:53:38 bird Exp $
  *
  * Description:   Autoprobes the os2krnl file and os2krnl[*].sym files.
@@ -104,5 +104,5 @@
     {FALSE, -1, 11, "_VMAllocMem",          -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 11 */
     {FALSE, -1, 11, "_VMGetOwner",          -1,  -1,  -1,  -1, EPT_PROCIMPORT32},  /* 12 */
-    {FALSE, -1, 11, "g_tkExecPgm",          -1,  -1,  -1,  -1, EPT_PROCIMPORT32},        /* 13 */ /* currently disabled! */
+    {FALSE, -1, 11, "g_tkExecPgm",          -1,  -1,  -1,  -1, EPT_PROC32},        /* 13 */ /* currently disabled! */
     {FALSE, -1, 11, "f_FuStrLenZ",          -1,  -1,  -1,  -1, EPT_PROCIMPORT16},  /* 14 */
     {FALSE, -1, 10, "f_FuStrLen",           -1,  -1,  -1,  -1, EPT_PROCIMPORT16},  /* 14 */
Index: trunk/src/win32k/include/options.h
===================================================================
--- trunk/src/win32k/include/options.h	(revision 2846)
+++ trunk/src/win32k/include/options.h	(revision 2848)
@@ -1,3 +1,3 @@
-/* $Id: options.h,v 1.7 2000-02-21 04:45:47 bird Exp $
+/* $Id: options.h,v 1.8 2000-02-21 14:53:39 bird Exp $
  *
  * Options.
@@ -44,5 +44,4 @@
             o.usCom         = OUTPUT_COM2;          \
             o.fLogging      = FALSE;                \
-//            o.fLogging      = TRUE;                 \
             o.fKernel       = KF_UNI;               \
             o.ulBuild       = ~0UL;                 \
@@ -52,5 +51,5 @@
             o.ulInfoLevel   = INFOLEVEL_QUIET;      \
             o.fElf          = FALSE;                \
-            o.fScript       = FALSE;                \
+            o.fScript       = TRUE;                 \
             o.fNoLoader     = FALSE;                \
             o.cbSwpHeapInit = CB_SWP_INIT;          \
Index: trunk/src/win32k/ldr/calltab.asm
===================================================================
--- trunk/src/win32k/ldr/calltab.asm	(revision 2846)
+++ trunk/src/win32k/ldr/calltab.asm	(revision 2848)
@@ -1,3 +1,3 @@
-; $Id: calltab.asm,v 1.10 2000-02-21 09:24:01 bird Exp $
+; $Id: calltab.asm,v 1.11 2000-02-21 14:53:39 bird Exp $
 ;
 ; callTab - Call back again table - table with entry for each function which is overrided.
@@ -34,7 +34,7 @@
     public _VMAllocMem@36
     public _VMGetOwner@8
-    public g_tkExecPgm
-    public f_FuStrLenZ
-    public f_FuBuff
+    public _g_tkExecPgm
+    public _f_FuStrLenZ
+    public _f_FuBuff
 
 
@@ -110,20 +110,20 @@
 _VMGetOwner@8 ENDP
 
-g_tkExecPgm PROC NEAR
+_g_tkExecPgm PROC NEAR
     db MAXSIZE_PROLOG dup(0cch)
-g_tkExecPgm ENDP
+_g_tkExecPgm ENDP
 
 
-f_FuStrLenZ PROC FAR
+_f_FuStrLenZ PROC FAR
     db MAXSIZE_PROLOG dup(0cch)
-f_FuStrLenZ ENDP
+_f_FuStrLenZ ENDP
 
-f_FuStrLen PROC FAR
+_f_FuStrLen PROC FAR
     db MAXSIZE_PROLOG dup(0cch)
-f_FuStrLen ENDP
+_f_FuStrLen ENDP
 
-f_FuBuff PROC FAR
+_f_FuBuff PROC FAR
     db MAXSIZE_PROLOG dup(0cch)
-f_FuBuff ENDP
+_f_FuBuff ENDP
 
 CALLTAB ENDS
Index: trunk/src/win32k/ldr/mytkExecPgm.asm
===================================================================
--- trunk/src/win32k/ldr/mytkExecPgm.asm	(revision 2846)
+++ trunk/src/win32k/ldr/mytkExecPgm.asm	(revision 2848)
@@ -1,3 +1,3 @@
-; $Id: mytkExecPgm.asm,v 1.6 2000-02-21 09:35:45 bird Exp $
+; $Id: mytkExecPgm.asm,v 1.7 2000-02-21 14:53:39 bird Exp $
 ;
 ; mytkExecPgm - tkExecPgm overload
@@ -17,7 +17,5 @@
 ;   Imported Functions
 ;
-DATA32 SEGMENT
-    extrn  g_tkExecPgm:PROC
-DATA32 ENDS
+    extrn  _g_tkExecPgm:PROC
     extrn  AcquireBuffer:PROC
     extrn  ReleaseBuffer:PROC
@@ -29,5 +27,5 @@
     ; return: cx size - CF clear
     ;         ax error- CF set
-    extrn  f_FuStrLenZ:PROC
+    extrn  _f_FuStrLenZ:PROC
 
     ; Stringlength
@@ -36,5 +34,5 @@
     ; return: cx size - CF clear
     ;         ax error- CF set
-    extrn  f_FuStrLen:PROC
+    extrn  _f_FuStrLen:PROC
 
     ;memcpy
@@ -42,8 +40,8 @@
     ;        es:di pointer to target
     ;        cx    count of bytes to copy
-    ;uses:   nearly all (save bp)
+    ;uses:   nearly all (save bp), es, ds
     ;return: success CF clear
     ;        failure CF set
-    extrn  f_FuBuff:PROC
+    extrn  _f_FuBuff:PROC
 
 ;
@@ -51,12 +49,5 @@
 ;
     public mytkExecPgm
-    public pszFilename
-    public pszArguments
-
-
-DATA32 SEGMENT
-pszFilename     dd 0                    ; Pointer to the filename (in the buffer)
-pszArguments    dd 0                    ; Pointer to the arguments (int the buffer)
-DATA32 ENDS
+
 
 
@@ -85,11 +76,18 @@
 mytkExecPgm PROC FAR
 pBuffer     = dword ptr -04h
-;SegBuffer   =  word ptr (dword ptr -08h)
 SegBuffer   = -08h
-;OffBuffer   =  word ptr (dword ptr -0Ch)
 OffBuffer   = -0Ch
 cchFilename = dword ptr -10h
 cchArgs     = dword ptr -14h
+;usExecFlag  = -18h
+;SegFilename = -1ch
+;OffFilename = -1eh
+;SegEnv      = -20h
+;OffEnv      = -22h
+;SegArg      = -24h
+;OffArg      = -26h
+
     ASSUME CS:CODE32, DS:NOTHING, SS:NOTHING
+    int 3
     push    ebp
     mov     ebp, esp
@@ -113,10 +111,14 @@
     mov     es, ax
     pushad
+    push    es
+    push    ds
     mov     bx, ds
     mov     di, dx                      ; es:di is now filename address (ds:dx).
     push    cs                          ; Problem calling far into the calltab segement.
-    call    near ptr FLAT:f_FuStrLen
+    call    near ptr FLAT:_f_FuStrLen
     movzx   ecx, cx
     mov     [ebp+cchFilename], ecx
+    pop     ds
+    pop     es
     popad
     jc      mytkExecPgm_CalltkExecPgm_X1; If the FuStrLen call failed we bail out!
@@ -125,6 +127,5 @@
     ; if filename length is more that CCHMAXPATH then we don't do anything!.
     ;
-    mov     ecx, [ebp+cchFilename]
-    cmp     ecx, 260
+    cmp     [ebp+cchFilename], 260
     jae     mytkExecPgm_CalltkExecPgm_X1; length >= 260
 
@@ -140,10 +141,14 @@
 
     pushad
+    push    es
+    push    ds
     mov     bx, di                      ;
     mov     di, si                      ; bx:di -> arguments
     push    cs                          ; Problem calling far into the calltab segement.
-    call    near ptr FLAT:f_FuStrLenZ
+    call    near ptr FLAT:_f_FuStrLenZ
     movzx   ecx, cx
     mov     [ebp+cchArgs], ecx
+    pop     ds
+    pop     es
     popad
     jc      mytkExecPgm_CalltkExecPgm_X1
@@ -179,4 +184,6 @@
     ;
     pushad
+    push    es
+    push    ds
     mov     di, ax                      ; es:di  pBuffer
     mov     si, dx
@@ -184,5 +191,7 @@
     mov     ecx, [ebp+cchFilename]
     push    cs                          ; Problem calling far into the calltab segement.
-    call    near ptr FLAT:f_FuBuff
+    call    near ptr FLAT:_f_FuBuff
+    pop     ds
+    pop     es
     popad
     jc      mytkExecPgm_CalltkExecPgm_X2
@@ -198,10 +207,13 @@
     jb      mytkExecPgm_CalltkExecPgm_2
     pushad
+    push    es
+    push    ds
     mov     ecx, [ebp+cchArgs]
-    mov     bx,[ebp+SegBuffer]
-    mov     ex, bx
     mov     bx, di                      ; ds:si -> arguments
-    push    cs                          ; Problem calling far into the calltab segement.
-    call    near ptr FLAT:f_FuBuff
+    mov     di, ax                      ; es:di -> buffer + 261
+    push    cs                          ; Problem calling far into the calltab segement.
+    call    near ptr FLAT:_f_FuBuff
+    pop     ds
+    pop     es
     popad
     jc      mytkExecPgm_CalltkExecPgm_X2
@@ -212,19 +224,8 @@
 
     ;
-    ; Set Pointers, pszFilename and pszArguments
-    ;
+    ; Restore variables pushed on the stack
+    ;
+    ; stack: edi, es, ds, ecx, eax
 mytkExecPgm_CalltkExecPgm_3:
-    mov     ax, seg FLAT:DATA32
-    mov     ds, ax
-    ASSUME  ds:FLAT
-    mov     eax, ss:[ebp+pBuffer]
-    mov     pszFilename, eax
-    add     eax, 261
-    mov     pszArguments, eax
-
-    ;
-    ; Restore variables pushed on the stack
-    ;
-    ; stack: edi, es, ds, ecx, eax
     pop     edi
     pop     es
@@ -234,5 +235,5 @@
 
     ;
-    ; Set new input parameters (call g_tkExecPgm)
+    ; Set new input parameters (call _g_tkExecPgm)
     ;
     ; ds:dx is to become SegBuffer:OffBuffer
@@ -251,8 +252,8 @@
 
     ;
-    ; Call g_tkExecPgm
-    ;
-    push    cs                          ; Problem calling far into the calltab segement.
-    call    near ptr FLAT:g_tkExecPgm
+    ; Call _g_tkExecPgm
+    ;
+    push    cs                          ; Problem calling far into the calltab segement.
+    call    near ptr FLAT:_g_tkExecPgm
     pushfd
 
@@ -292,5 +293,6 @@
 
 mytkExecPgm_CalltkExecPgm:
-    call    far ptr FLAT:g_tkExecPgmStub
+    push    cs
+    call    near ptr FLAT:_g_tkExecPgm
     leave
     retf
@@ -298,13 +300,196 @@
 
 
-;;
-; Stub which jumps to g_tkExecPgmStub.
-; (This way I will hopefully get the right selector.)
-g_tkExecPgmStub PROC FAR
-    jmp     near ptr FLAT:g_tkExecPgm
-g_tkExecPgmStub ENDP
-
 
 CODE32 ENDS
+
+if 0 ; alternate implementation.
+mytkExecPgm PROC FAR
+pBuffer     = dword ptr -04h
+SegBuffer   = -08h
+OffBuffer   = -0Ch
+cchFilename = -10h
+cchArgs     = -14h
+usExecFlag  = -18h
+SegFilename = -1ch
+OffFilename = -1eh
+SegEnv      = -20h
+OffEnv      = -22h
+SegArg      = -24h
+OffArg      = -26h
+
+    ASSUME CS:CODE32, DS:NOTHING, SS:NOTHING
+    int 3
+    push    ebp
+    mov     ebp, esp
+    lea     esp, [ebp + OffArg]
+
+    ; save input parameters
+    mov     [ebp + usExecFlag], ax
+    mov     ax, es
+    mov     [ebp + SegEnv], ax
+    mov     [ebp + OffEnv], bx
+    mov     [ebp + SegArg], di
+    mov     [ebp + OffArg], si
+    mov     ax, ds
+    mov     [ebp + SegFilename], ax
+    mov     [ebp + OffFilename], dx
+
+    ; parameter validations
+    cmp     ax, 4                       ; pointer to filename
+    jb      mytkExecPgm_CalltkExecPgm_X1
+
+    ;
+    ; filename length
+    ;
+    mov     bx, ax
+    mov     di, dx                      ; bx:di is now filename address
+    push    cs                          ; Problem calling far into the calltab segement.
+    call    near ptr FLAT:_f_FuStrLen
+    jc      mytkExecPgm_CalltkExecPgm_X1; If the FuStrLen call failed we bail out!
+
+    ;
+    ; if filename length is more that CCHMAXPATH then we don't do anything!.
+    ;
+    cmp     cx, 260
+    jae     mytkExecPgm_CalltkExecPgm_X1; length >= 260
+    mov     [ebp+cchFilename], cx
+
+    ;
+    ; args length
+    ; Note: the arguments are a series of ASCIIZs ended by an empty string (ie. '\0').
+    ;
+    mov     bx, [ebp+SegArg]
+    cmp     bx, 4                       ; The argument might me an NULL pointer
+    xor     cx, cx
+    jb      mytkExecPgm_CalltkExecPgm_1
+
+    mov     di, [ebp+OffArg]            ; bx:di -> arguments
+    push    cs                          ; Problem calling far into the calltab segement.
+    call    near ptr FLAT:_f_FuStrLenZ
+    mov     [ebp+cchArgs], cx
+    jc      mytkExecPgm_CalltkExecPgm_X1
+
+mytkExecPgm_CalltkExecPgm_1:
+    add     cx, [ebp+cchFilename]       ; filename length
+    add     cx, 3 + 260                 ;  260 = new argument from a scrip file or something.
+                                        ;    3 = two '\0's and a space after added argument.
+    cmp     ecx, 1536                   ; 1536 = Buffersize.  FIXME! Define this!!!
+    jae     mytkExecPgm_CalltkExecPgm_X1; jmp if argument + file + new file > buffer size
+
+    ;
+    ; Aquire a buffer
+    ;
+    call    AcquireBuffer
+    mov     [ebp+pBuffer], eax
+    or      eax, eax
+    jz      mytkExecPgm_CalltkExecPgm_X1; Failed to get buffer.
+
+    ;
+    ; Get Segment and offset for the buffer
+    ;
+    call    QueryBufferSegmentOffset
+    mov     cx, es
+    mov     [ebp+OffBuffer], ax
+    mov     [ebp+SegBuffer], es
+    test    eax, 000570000h
+    jnz     mytkExecPgm_CalltkExecPgm_X2
+
+    ;
+    ; Copy filename to pBuffer.
+    ;
+    mov     di, ax                      ; es:di  pBuffer
+    mov     si, dx
+    mov     bx, ds                      ; bx:si  Filename pointer (input ds:dx)
+    mov     cx, [ebp+cchFilename]       ; cx = length of area to copy
+    push    cs                          ; Problem calling far into the calltab segement.
+    call    near ptr FLAT:_f_FuBuff
+    jc      mytkExecPgm_CalltkExecPgm_X2
+
+    ;
+    ; Copy Args to pBuffer + 261
+    ;
+    mov     si, [ebp+SegArg]
+    cmp     si, 4
+    jb      mytkExecPgm_CalltkExecPgm_2
+    mov     ds, si
+    mov     si, [ebp+OffArg]            ; ds:si -> arguments
+    mov     di, [ebp+SegBuffer]
+    mov     es, di
+    mov     di, [ebp+OffBuffer]
+    add     di, 261                     ; es:di -> buffer + 261
+    mov     cx, [ebp+cchArgs]           ; cx = length of area to copy
+    push    cs                          ; Problem calling far into the calltab segement.
+    call    near ptr FLAT:_f_FuBuff
+    jc      mytkExecPgm_CalltkExecPgm_X2
+    jmp     mytkExecPgm_CalltkExecPgm_3
+
+mytkExecPgm_CalltkExecPgm_2:
+    mov     word ptr es:[eax], 0        ; Terminate the empty string!
+
+    ;
+    ; Set new input parameters (call _g_tkExecPgm)
+    ;
+    ; ds:dx is to become SegBuffer:OffBuffer
+    ; di:si is to become SegBuffer:OffBuffer+261
+    ;
+mytkExecPgm_CalltkExecPgm_3:
+    mov     di, [ebp+SegBuffer]
+    mov     ds, di
+    mov     si, [ebp+OffBuffer]
+    mov     dx, si                      ; ds:dx  SegBuffer:OffBuffer
+    add     si, 261                     ; di:si  SegBuffer:OffBuffer+261
+    mov     bx, [ebp+SegEnv]
+    mov     es, bx
+    mov     bx, [ebp+SegEnv]
+
+    ;
+    ; Call _g_tkExecPgm
+    ;
+    push    cs                          ; Problem calling far into the calltab segement.
+    call    near ptr FLAT:_g_tkExecPgm
+    pushfd
+
+    ;
+    ; Release buffer
+    ;
+    push    eax
+    mov     eax, [ebp + pBuffer]
+    call    ReleaseBuffer
+    mov     [ebp + pBuffer], 0
+    pop     eax
+
+    ;
+    ; Return
+    ;
+    push    [ebp + SegFilename]
+    pop     ds
+    push    [ebp + SegEnv]
+    pop     es
+    popfd
+    leave
+    retf
+
+mytkExecPgm_CalltkExecPgm_X2:
+    ;
+    ; Release buffer
+    ;
+    mov     eax, [ebp + pBuffer]
+    call    ReleaseBuffer
+    mov     [ebp + pBuffer], 0
+
+mytkExecPgm_CalltkExecPgm_X1:
+    pop     ds
+
+mytkExecPgm_CalltkExecPgm:
+    push    cs
+    call    near ptr FLAT:_g_tkExecPgm
+    leave
+    retf
+mytkExecPgm ENDP
+
+CODE32 ENDS
+endif
+
+
 END
 
