I have a mixed network of PCs from W95 through W2K.
I writing an installer for a Company Font ( special symbols for our industry ).

I am using SHGetSpecialFolderPath to a path to System Folder for Fonts.
This is OK for W98+, W95 complains with an Export error when the program runs.

I have some conditional code for a work around as far as the path is concerned for W95.

I would still like to use SHGetSpecialFolderPath for the other systems without tripping the Export error on the W95s.

I believe I can work around the error by using LoadLibrary with GetProcAddress.

Anyone has any other ideas or recommendations?

Regards, P1
Posted on 2002-11-08 11:26:45 by Pone
What you are saying is that you want a workaround of some sort
to retrieving the \fonts\ folder-location. It sounds to me that you
dont need to use that specific api-function.

Company machines are usually setup in the traditional way without
changing i.e the name of the '\fonts\' folder or the whereabout's of it.
I would rather just use the 'GetWindowsDirectory' and just add '\fonts'
to the retrieved path.

Since the api-function you are using is in need of 'Internet Explorer v.4'
being installed on the system. And my guess would be that the W95
box's wouldnt have that upgrade because they prolly dont use it.

In other words the .dll file called: 'shell32.dll' needs to be atleast version
4.71 or later. But the 'GetWindowsDirectory' works on any windows type/version.

Atleast 90% Of the company machines will probably have their font folder's
located like this:
:>Windows/9X: C:\WINDOWS\FONTS
:>Windows/NT: C:\WINNT\FONTS
Posted on 2002-11-08 14:13:10 by natas
the SHGetSpecialFolderPath is simply a short version of SHGetSpecialFolderLocation, which works on every system.
you will need this short code shippy:
;----------------- get windows fonts

lea eax, idlPath
push eax
call SHGetSpecialFolderLocation
test eax, eax
jne infDone

push lpszDir
push idlPath
call SHGetPathFromIDList

lea eax, hcomMalloc
push eax
call SHGetMalloc
test eax, eax
jne infEnum

push idlPath
callother hcomMalloc, imal_Free
callother hcomMalloc, iunk_Release
Posted on 2002-11-11 04:37:03 by beaster
I didn't know about that api call, so thanks for adding some
usefull information about it.

I thought that all of the api call's similar to 'SHGetSpecialFolderPath'
needed a 'shell32.dll' of a newer date(never used the shell32.dll).
Then let's say an old Windows/95 System ;)

Thanks for enligthening me! How can one stop learning with so much knowledge 'floating' around? :alright:
Posted on 2002-11-11 04:56:07 by natas
beaster: I was using a variant of your snippet and found two things.
1. Plain old 95 gives an unknown error.
2. Does not run on W2K and because we don't use XP, I am assuming it will not run there too.

natas: I know the defaults will cover 99+% of installations. But I am with this special font file supporting windozes system outside the company for vendors & customers. So I needed it to be as 'idiot proof' as possible.

Thanks for the input!!

Regards, P1

Code snippet I was using that was simular to beaster's.

include \masm32\include\Shell32.inc
include \masm32\include\CoLib\Oaidl.inc


;Does not work on W95, without IE updated.
;l_HWND - In, Optional, otherwise use NULL
;CSIDL_ID - In, See CSIDL_XX... for Folder requested.
;DPFname - In & Out, szVariable for Drive\Path\FileName.


lea eax,pidl
mov ppidl,eax
Invoke SHGetSpecialFolderLocation, l_HWND, CSIDL_ID, ppidl
.if eax == NOERROR
Invoke SHGetPathFromIDListA, pidl, DPFname
lea eax,pIM
mov ppIM,eax
Invoke SHGetMalloc, ppIM
coinvoke ppIM, IMalloc, Free, ppidl
;Next line OK on 98,Not NT
;coinvoke ppIM, IMalloc, Release
xor eax,eax
;eax, returns error number
SH32_Folders endp
Posted on 2002-11-12 08:54:32 by Pone
In you'r post you say that the api 'SHGetSpecialFolderLocation' didn't work
on Windows/2K? Since I have this OS I thought I would check it out.

Surely enough, when I executed your code the crash dialog popped up.
But it only crashed due to the IMalloc not the main api call.

Anyways, without any knowledge to this topic I decided to research from MSDN.
And what you see below is what I managed to slap together. It produces no
crashes whatsoever on my machine and it returns with the system Fonts folder.
( Now, if someone could just test it on multiple platforms? hmm). :alright:

Path db 512 dup (0)
pPidl dd ?
ppIM dd ?
invoke SHGetSpecialFolderLocation,0,CSIDL_FONTS,addr pPidl
.if (eax == NOERROR)
invoke SHGetPathFromIDList,pPidl,addr Path
invoke SHGetMalloc,addr ppIM
coinvoke ppIM, IMalloc, Free, addr pPidl
coinvoke ppIM, IMalloc, Release
invoke StdOut,addr Path
invoke ExitProcess,0
MSDK QUOTE: "With Microsoft? Windows? 2000, this function is superseded by SHGetFolderLocation"
Posted on 2002-11-12 11:31:34 by natas

Please give version of windows.inc your using.
Mine gives me a bunch of :
\MASM32\INCLUDE\WINDOWS.INC(7890) : error A2179: structure improperly initialized
\MASM32\INCLUDE\WINDOWS.INC(7890) : error A2008: syntax error : in structure

Thanks, P1
Posted on 2002-11-12 13:07:46 by Pone
WINDOWS.INC for 32 bit MASM (Version 1.25a) 22 October 2001
Posted on 2002-11-12 13:20:40 by natas
2Pone :
for the errors to dissapear, need

[color=red]OPTION CASEMAP:NONE[/color] ; <--- add this string

Posted on 2002-11-12 13:46:08 by Eviloid
Still it worked when I compiled it though! Oh well Im tired(been up for 26hrs now) :alright:
Posted on 2002-11-12 13:49:14 by natas
Note: Will not work on W95 without IE5 or better installed.

Thanks to natas & Eviloid for their help.

Would someone test it on XP please.

Regards, P1
Posted on 2002-11-13 12:41:55 by Pone
Pone, works fine on XP.

XP Professional with IE 6.0 but without SP1 to be exact.
Posted on 2002-11-13 12:51:26 by Qweerdy

I appreciated the beta testing!
See you later.

Regards, P1
Posted on 2002-11-15 08:37:07 by Pone