The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: czDrillard on January 13, 2005, 04:56:18 PM

Title: Missing export
Post by: czDrillard on January 13, 2005, 04:56:18 PM
Hello everybody,

My program uses SHGetFolderPath function.  This works on Windows XP and Windows 2000 but on Windows 98SE I get error dialog box with message: "The exe file is linked to missing export SHELL32.DLL:  SHGetFolderPathW"

The SDK says this function is implemented in a redistributable dynamic-link library (DLL), SHFolder.dll.  I linked to SHFolder.inc and copied SHFolder.dll to my Windows 98 System32 directory but still get error message.

Anybody get this function working on 98?  Any links, or suggestions much appreciated.

best regards,

czDrillard
Title: Re: Missing export
Post by: jimh on January 13, 2005, 05:26:35 PM
It sounds as if you are trying to use a UNICODE function on Win98 (which it doesn't support), but I looked at the \masm32\include\shfolder.inc file and if you use SHGetFolderPath, then it equates to SHGetFolderPathA which IS supported and shouldn't give you that particular error.  If you call the SHGetFolderPathW function then I'd see the reason for the error.

I admit I don't know much about compiling for a UNICODE app...all of my experience has stayed withing ANSI and if I absolutely needed to call a UNICODE function I converted the data to/from ANSI/UNICODE and worked from there.
Title: Re: Missing export
Post by: czDrillard on January 13, 2005, 05:33:39 PM
Thanks for your reply jimh.  My call looks like this:invoke SHGetFolderPath,NULL,CSIDL_RECENT ,NULL,SHGFP_TYPE_CURRENT,ADDR FullPathBuf

Not using unicode.

best regards,

czDrillard

Title: Re: Missing export
Post by: P1 on January 13, 2005, 07:43:03 PM
Humor me on this and try out a theory.

Build the project on the W98 machine and test on the W2X machine.

Regards,  P1  :8)

PS:  I no longer have a software developement W98 system at work any more.  At Home, yes.
Title: Re: Missing export
Post by: MichaelW on January 14, 2005, 03:33:05 AM
QuoteI linked to SHFolder.inc and copied SHFolder.dll to my Windows 98 System32 directory but still get error message.
For Windows 98 it should be the  System directory, and on my Windows 98 SE, SHFOLDER.DLL version 5.00.2614.3500 is already there. But I have doubts that this is your problem.



Title: Re: Missing export
Post by: donkey on January 14, 2005, 03:49:15 AM
I did a scan of all my programs and I have *alot* of file manipulation and explorer type test programs and I cannot find a single instance where I used that function. I seem to remember having problems with it but on NT4/95 so I dumped it in favour of the more drawnout version...

invoke SHGetSpecialFolderLocation,NULL,[csidl],offset PIDL
invoke SHGetPathFromIDListA,[PIDL],offset szPath


In essence it does the same thing but it is NT4/95 compatible without any particular version of IE installed. I have tested this on both of those OSes without a problem. Note that I usually use a 32 DWORD buffer for PIDL.

You may also want to try to load it directly using LoadLibrary/GetProcAddress to see if it is a problem with the import library.
Title: Re: Missing export
Post by: MichaelW on January 14, 2005, 03:58:42 AM
Built and worked OK under Windows 2000 (C:\Documents and Settings\Administrator\Recent), and worked OK under Windows 98 SE (C:\WINDOWS\Recent).

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    .486                       ; create 32 bit code
    .model flat, stdcall       ; 32 bit memory model
    option casemap :none       ; case sensitive

    include \masm32\include\windows.inc
    include \masm32\include\masm32.inc
    include \masm32\include\kernel32.inc
    include \masm32\include\shfolder.inc

    includelib \masm32\lib\masm32.lib
    includelib \masm32\lib\kernel32.lib
    includelib \masm32\lib\shfolder.lib

    include \masm32\macros\macros.asm

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    .data
      FullPathBuf db 260 dup(0)
    .code

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

start:

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

    SHGFP_TYPE_CURRENT equ 0 ; current value for user, verify it exists
    SHGFP_TYPE_DEFAULT equ 1 ; default value, may not exist

    invoke SHGetFolderPath,
                            NULL,
                            CSIDL_RECENT,
                            NULL,
                            SHGFP_TYPE_CURRENT,
                            ADDR FullPathBuf
    print ADDR FullPathBuf

    mov   eax, input(13,10,"Press enter to exit...")
    exit

; «««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

end start

Title: Re: Missing export
Post by: donkey on January 14, 2005, 04:08:12 AM
Hi,

Forgot to show you how to free the PIDL, it must be freed using the Shells IMalloc interface but there is a function for that in XP+ that is also available as an ordinal in all OS versions...

(ILFree by ordinal)
invoke Shell32.dll:155, [PIDL]
Title: Re: Missing export
Post by: czDrillard on January 14, 2005, 07:13:05 AM
Big thanks to everybody for replies  :U

Donkey, beleive or not I originally was using those two functions but switched for simplicity (no piddlin around :wink )  I can always go back to them but rather not.

MichaelW, your code is very interesting, I compiled it and ran it under xp no problems, compiled and ran under 98SE again no problem.  Strange...   I noticed my program which wouldn't run had a lot of includes.  So I added shell32.inc and shell32.lib to your code and the error message was generated.  Seems to be some conflict with the includes.  Maybe loads shell32 and ignores SHfolder.  This gets weirder.  If shell32 inc and lib is before shfolder inc and lib files, error is generated.  If shell32 is after shfolder inc and lib, no error ??

Any ideas?  don't really matter my program runs now but this is strange, no?


best regards,

czDrillard
Title: Re: Missing export
Post by: pbrennick on January 15, 2005, 01:42:03 AM
Actually, when you think about it, with all the different DLLs in windows being created by so many different individuals, it is a wonder that this type of thing does not happen more often.
Paul
Title: Re: Missing export
Post by: MichaelW on January 15, 2005, 03:44:09 AM
I see now I misunderstood your first post :red

It looks like the problem is the include files and/or MASM32 libraries. The three declarations in shfolder.inc:

SHGetFolderPathA PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD
SHGetFolderPath equ <SHGetFolderPathA>
SHGetFolderPathW PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD

Are also in shell32.inc. I suspect you could correct the problem under Windows 98 SE by just deleting the shfolder includes.