ReactOS 0.4.16-dev-320-g3bd9ddc
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
12inline 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
int FixLFN(const TCHAR *pBadFileName, TCHAR *pGoodFileName)
Definition: FixLFN.h:12
unsigned long DWORD
Definition: ntddk_ex.h:95
GLfloat GLfloat p
Definition: glext.h:8902
#define _tcscpy
Definition: tchar.h:623
#define _tcsrchr
Definition: utility.h:116
#define SHGetFileInfo
Definition: shellapi.h:698
#define SHGFI_DISPLAYNAME
Definition: shellapi.h:167
CHAR szDisplayName[MAX_PATH]
Definition: shellapi.h:369
char TCHAR
Definition: xmlstorage.h:189