source: trunk/src/win32k/ldr/myldrGetFileName.asm@ 10367

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

Calltable fixes. Handle event. New 14062e kernels.

File size: 2.8 KB
Line 
1; $Id: myldrGetFileName.asm,v 1.2 2001-02-23 02:57:54 bird Exp $
2;
3; myldrGetFileName2 - assembly helper for ldrGetFileName.
4; This makes ldrGetFileName work for filenames which
5; doesn't have a path, and return correct *ppachExt.
6;
7; Copyright (c) 2000 knut st. osmundsen
8;
9; Project Odin Software License can be found in LICENSE.TXT
10;
11 .386p
12
13;
14; Include files
15;
16 include devsegdf.inc
17 include options.inc
18
19;
20; Exported symbols
21;
22 public _ldrGetFileName2@12
23
24;
25; Externs
26;
27 extrn _ldrGetFileName@12:PROC ; calltab entry
28
29
30CODE32 segment
31CODE32START label byte
32
33;;
34; Assembly helper for ldrGetFileName.
35; This makes ldrGetFileName work for filenames which doesn't have a path.
36; @cproto ULONG LDRCALL ldrGetFileName2(PSZ pszFilename, PCHAR *ppachName, PCHAR *ppachExt);
37; @status completely implemented.
38; @author knut st. osmundsen
39; @remark This function relies heavily on the implementation of ldrGetFileName.
40; We help ldrGetFileName by initiating the register which hold the start of
41; the filename, edx, to the the correct value for filenames without path or
42; with only a driveletter specified.
43_ldrGetFileName2@12 PROC NEAR
44 ASSUME ds:FLAT
45
46 ;
47 ; Initiate the edx register incase there is no path or just a driveletter.
48 ;
49 mov edx, dword ptr [esp + 4]
50 cmp byte ptr [edx], 0
51 je lgfn_call
52 cmp byte ptr [edx+1], ':'
53 jne lgfn_call
54 inc edx
55
56lgfn_call:
57 ;
58 ; Re-push the arguments and call the real function.
59 ;
60 push dword ptr [esp + 0ch]
61 push dword ptr [esp + 0ch]
62 push dword ptr [esp + 0ch]
63 call _ldrGetFileName@12
64
65 ;
66 ; Check if the extention pointer is pointer after the terminator ('\0') char.
67 ;
68 mov ecx, dword ptr [esp + 08h] ; fetch the ppachName parameter.
69 mov ecx, [ecx] ; fetch the name pointer returned by ldrGetFileName.
70 cmp byte ptr [ecx], 0 ; Check if no name (nor extention).
71 je lgfn_zeroppachExt ; Jump if no name.
72
73 mov edx, dword ptr [esp + 0ch] ; fetch the ppachExt parameter.
74 mov edx, [edx] ; fetch the extention pointer returned by ldrGetFileName.
75 dec edx ; decrement the pointer.
76
77 cmp edx, ecx ; check if the decremented pointer is legal.
78 jl lgfn_ret
79
80 cmp byte ptr [edx], 0 ; If the pointer before *ppachExt is '\0' then *ppachExt should be NULL.
81 jne lgfn_ret ; Jump if *ppachExt is ok.
82
83lgfn_zeroppachExt:
84 mov edx, dword ptr [esp + 0ch] ; fetch the ppachExt parameter.
85 mov dword ptr [edx], 0 ; = NULL.
86
87lgfn_ret:
88 ret 0ch
89_ldrGetFileName2@12 ENDP
90
91CODE32 ends
92
93END
94
95
96
Note: See TracBrowser for help on using the repository browser.