ReactOS  0.4.14-dev-52-g6116262
FixLFN.h
Go to the documentation of this file.
1 //
2 // FixLFN.h
3 //
4 
5 #ifndef __FIXLFN_H
6 #define __FIXLFN_H
7 
8 #include <string.h>
9 #include <tchar.h>
10 #include <shellapi.h>
11 
12 inline int FixLFN ( const TCHAR* pBadFileName, TCHAR* pGoodFileName )
13 {
14  SHFILEINFO sfi;
15  TCHAR* p;
16 
17  DWORD dwResult = SHGetFileInfo ( pBadFileName, 0, &sfi, sizeof(sfi), SHGFI_DISPLAYNAME );
18  if ( dwResult )
19  {
20  if ( pGoodFileName != pBadFileName )
21  _tcscpy ( pGoodFileName, pBadFileName );
22  if ( (p = _tcsrchr ( pGoodFileName, '\\' )) )
23  _tcscpy ( p+1, sfi.szDisplayName );
24  else if ( (p = _tcsrchr ( pGoodFileName, '/' )) )
25  _tcscpy ( p+1, sfi.szDisplayName );
26  else
27  _tcscpy ( pGoodFileName, sfi.szDisplayName );
28  }
29  return dwResult;
30 }
31 
32 #endif//__FIXLFN_H
_TCHAR * _tcscpy(_TCHAR *to, const _TCHAR *from)
Definition: tcscpy.h:8
int FixLFN(const TCHAR *pBadFileName, TCHAR *pGoodFileName)
Definition: FixLFN.h:12
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:164
char TCHAR
Definition: xmlstorage.h:189
CHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:366
unsigned long DWORD
Definition: ntddk_ex.h:95
_TCHAR * _tcsrchr(const _TCHAR *s, _XINT c)
Definition: tcsrchr.h:4
#define SHGetFileInfo
Definition: shellapi.h:693
GLfloat GLfloat p
Definition: glext.h:8902