sgindgen.cpp File Reference

(r1785/r1361)

#include "camtypes.h"
#include "sgindgen.h"

Go to the source code of this file.

Defines

#define new   CAM_DEBUG_NEW

Functions

BOOL MakeShortPath (LPTSTR lpszPath, size_t cchMaxLen)
 Special function to work around an ommission in Win32s, which does not include the GetShortPathName function, even though Win32s is supposed to export ALL Win32 functions. This version does nothing under Win32s, which shortens pathnames automatically (?), under other versions of Windows it dynamically links to the function in the kernel32 library, thus avoiding an explicit link to the function which would prevent the app loading.
 DECLARE_SOURCE ("$Revision: 1361 $")

Variables

static BOOL QuietThumbnail = FALSE
static BOOL StopIndGen = FALSE
static FilePos LastFoundItemInIndex = 0


Define Documentation

#define new   CAM_DEBUG_NEW
 

Definition at line 146 of file sgindgen.cpp.


Function Documentation

DECLARE_SOURCE "$Revision: 1361 $"   ) 
 

BOOL MakeShortPath LPTSTR  lpszPath,
size_t  cchMaxLen
 

Special function to work around an ommission in Win32s, which does not include the GetShortPathName function, even though Win32s is supposed to export ALL Win32 functions. This version does nothing under Win32s, which shortens pathnames automatically (?), under other versions of Windows it dynamically links to the function in the kernel32 library, thus avoiding an explicit link to the function which would prevent the app loading.

Author:
Justin_Flude (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/6/95
Parameters:
lpszPath the full path to shorten. The shortened version will be [INPUTS] "outputed" into this same buffer. cchMaxLen the size of the above buffer
lpszPath contains the shortened path [OUTPUTS]
Returns:
TRUE if successful, FALSE otherwise.

Errors: -

See also:
-

Definition at line 514 of file helpuser.cpp.

00515 {
00516 PORTNOTETRACE("help", "Help function unimplemented!");
00517 #if !defined(EXCLUDE_FROM_XARALX)
00518     // Under Win32s we don't want to do this, because (i) Win32s does it anyway;
00519     // and (ii) the bloody GetShortPathName function isn't supported because they
00520     // forgot it (a serious bug, Mr Gates!)
00521     if (IsWin32s() && !IsWin32c()) return TRUE;
00522 
00523     // Now we have some aggro.  Because GetShortPathName isn't recognised as a Win32
00524     // function by Win32s, we must NOT have any explicit references to it in the program,
00525     // or the app won't load under Win32s.  Instead, we will try to dynamically link to it.
00526     HMODULE hlib = ::GetModuleHandle(TEXT("KERNEL32"));
00527     if (hlib == NULL)
00528     {
00529         TRACEUSER( "Ollie", _T("MakeShortPath: GetModuleHandle failed (error: %lu)\n"),
00530                                 (UINT32) ::GetLastError());
00531         return FALSE;
00532     }
00533 
00534     // OK, we've loaded the relevant library.  Now try to link to the function it contains.
00535     typedef DWORD (WINAPI *GSPNFUNC)(LPCTSTR, LPTSTR, DWORD);
00536     GSPNFUNC lpfn = (GSPNFUNC) ::GetProcAddress(hlib, GETSHORTPATHNAME);
00537     if (lpfn == NULL)
00538     {
00539         TRACEUSER( "Ollie", _T("MakeShortPath: GetProcAddress failed (error: %lu)\n"),
00540                                 (UINT32) ::GetLastError());
00541         return FALSE;
00542     }
00543 
00544     // Now call the GetShortPathName function and return a success code.
00545     DWORD dwResult = (*lpfn)(lpszPath, lpszPath, cchMaxLen);
00546     return dwResult != 0 && dwResult < cchMaxLen;
00547 #else
00548     return FALSE;
00549 #endif
00550 }


Variable Documentation

FilePos LastFoundItemInIndex = 0 [static]
 

Definition at line 177 of file sgindgen.cpp.

BOOL QuietThumbnail = FALSE [static]
 

Definition at line 172 of file sgindgen.cpp.

BOOL StopIndGen = FALSE [static]
 

Definition at line 175 of file sgindgen.cpp.


Generated on Sat Nov 10 03:49:36 2007 for Camelot by  doxygen 1.4.4