Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 7a89ea0c authored by rswindell's avatar rswindell

Using Win95-compatible FindFirstFile instead of GetLongFileName (Win98+)

to get long filenames.
parent a905ef8f
...@@ -46,11 +46,6 @@ void sbbs_t::fileinfo(file_t* f) ...@@ -46,11 +46,6 @@ void sbbs_t::fileinfo(file_t* f)
char tmp[512]; char tmp[512];
char path[MAX_PATH+1]; char path[MAX_PATH+1];
uint i,j; uint i,j;
#ifdef _WIN32
char* p;
char lfn[MAX_PATH+1];
DWORD lfn_len;
#endif
for(i=0;i<usrlibs;i++) for(i=0;i<usrlibs;i++)
if(usrlib[i]==cfg.dir[f->dir]->lib) if(usrlib[i]==cfg.dir[f->dir]->lib)
...@@ -68,14 +63,17 @@ void sbbs_t::fileinfo(file_t* f) ...@@ -68,14 +63,17 @@ void sbbs_t::fileinfo(file_t* f)
bprintf(text[FiDir],j+1,cfg.dir[f->dir]->lname); bprintf(text[FiDir],j+1,cfg.dir[f->dir]->lname);
bprintf(text[FiFilename],fname); bprintf(text[FiFilename],fname);
#ifdef _WIN32 #ifdef _WIN32
if(f->size!=-1 && Win98GetLongPathName!=NULL) { /* Windows 98/2K or later */ if(f->size!=-1) {
WIN32_FIND_DATA finddata;
HANDLE h=FindFirstFile(path,&finddata);
if(h!=INVALID_HANDLE_VALUE) {
lfn_len=Win98GetLongPathName(path,lfn,sizeof(lfn)); if(stricmp(finddata.cFileName,fname))
bprintf(text[FiFilename],finddata.cFileName);
if(lfn_len!=0 && lfn_len!=strlen(path)) { FindClose(h);
p=strrchr(lfn,'\\');
if(p!=NULL)
bprintf(text[FiFilename],p+1);
} }
} }
#endif #endif
......
...@@ -377,10 +377,6 @@ bool sbbs_t::listfile(char *fname, char HUGE16 *buf, uint dirnum ...@@ -377,10 +377,6 @@ bool sbbs_t::listfile(char *fname, char HUGE16 *buf, uint dirnum
uchar alt; uchar alt;
int i,j; int i,j;
ulong cdt; ulong cdt;
#ifdef _WIN32
char lfn[MAX_PATH+1];
DWORD lfn_len;
#endif
if(buf[F_MISC]!=ETX && (buf[F_MISC]-SP)&FM_EXTDESC && useron.misc&EXTDESC) { if(buf[F_MISC]!=ETX && (buf[F_MISC]-SP)&FM_EXTDESC && useron.misc&EXTDESC) {
getextdesc(&cfg,dirnum,datoffset,ext); getextdesc(&cfg,dirnum,datoffset,ext);
...@@ -440,16 +436,20 @@ bool sbbs_t::listfile(char *fname, char HUGE16 *buf, uint dirnum ...@@ -440,16 +436,20 @@ bool sbbs_t::listfile(char *fname, char HUGE16 *buf, uint dirnum
#ifdef _WIN32 #ifdef _WIN32
if(!(cfg.file_misc&FM_NO_LFN) && Win98GetLongPathName!=NULL) { if(exist && !(cfg.file_misc&FM_NO_LFN)) {
WIN32_FIND_DATA finddata;
HANDLE h=FindFirstFile(path,&finddata);
lfn_len=Win98GetLongPathName(path,lfn,sizeof(lfn)); if(h!=INVALID_HANDLE_VALUE) {
if(lfn_len!=0 && lfn_len!=strlen(path)) {
ptr=strrchr(lfn,'\\'); if(stricmp(finddata.cFileName,fname) && stricmp(finddata.cFileName,str))
if(ptr!=NULL bprintf("%.*s\r\n%21s",LEN_FDESC,finddata.cFileName,"");
&& stricmp(ptr+1,str)) // Not same as description
bprintf("%.*s\r\n%21s",LEN_FDESC,ptr+1,""); FindClose(h);
} }
} }
#endif #endif
if(!ext[0]) { if(!ext[0]) {
if(search[0]) { /* high-light string in string */ if(search[0]) { /* high-light string in string */
......
...@@ -56,8 +56,6 @@ uint riobp; ...@@ -56,8 +56,6 @@ uint riobp;
HANDLE exec_mutex=NULL; HANDLE exec_mutex=NULL;
HINSTANCE hK32=NULL; HINSTANCE hK32=NULL;
GetLongPathName_t Win98GetLongPathName=NULL;
#if defined(_DEBUG) && defined(_MSC_VER) #if defined(_DEBUG) && defined(_MSC_VER)
HANDLE debug_log=INVALID_HANDLE_VALUE; HANDLE debug_log=INVALID_HANDLE_VALUE;
_CrtMemState mem_chkpoint; _CrtMemState mem_chkpoint;
...@@ -3435,10 +3433,6 @@ void DLLCALL bbs_thread(void* arg) ...@@ -3435,10 +3433,6 @@ void DLLCALL bbs_thread(void* arg)
return; return;
} }
hK32 = LoadLibrary("KERNEL32"); hK32 = LoadLibrary("KERNEL32");
if(hK32!=NULL)
Win98GetLongPathName
= (GetLongPathName_t)GetProcAddress(hK32,"GetLongPathNameA");
#endif // _WIN32 #endif // _WIN32
pthread_mutex_init(&event_mutex,NULL); pthread_mutex_init(&event_mutex,NULL);
......
...@@ -58,15 +58,10 @@ ...@@ -58,15 +58,10 @@
#include <crtdbg.h> /* Windows debug macros and stuff */ #include <crtdbg.h> /* Windows debug macros and stuff */
#endif #endif
typedef DWORD(WINAPI * GetLongPathName_t)(LPCTSTR,LPTSTR,DWORD);
#if defined(__cplusplus) #if defined(__cplusplus)
extern "C" { extern "C"
#endif
extern HINSTANCE hK32;
extern GetLongPathName_t Win98GetLongPathName;
#if defined(__cplusplus)
}
#endif #endif
extern HINSTANCE hK32;
#elif defined(__unix__) /* Unix-variant */ #elif defined(__unix__) /* Unix-variant */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment