// Missing function...
/*
-#ifndef WNetGetResourceInformation
+#ifndef WNetGetResourceInformation
DWORD APIENTRY WNetGetResourceInformationA(LPNETRESOURCE lpNetResource, LPVOID lpBuffer, LPDWORD lpcbBuffer, LPTSTR* lplpSystem);
#ifdef UNICODE
#define WNetGetResourceInformation WNetGetResourceInformationW
{
Window editData = class::OnEdit(dataBox, obsolete, x + 24, y, w - 48, h, userData);
Button load
- {
+ {
dataBox, inactive = true, text = $"Import"."Imp", hotKey = f2,
position = { Max(x + 24, x + w - 24), y }, size = { 24, h };
}
};
Button save
- {
+ {
dataBox, inactive = true, text = $"Export"."Exp", hotKey = f2,
position = { Max(x + 24, x + w - 48), y }, size = { 24, h };
{
byte buffer[4096];
uint read = input.Read(buffer, 1, sizeof(buffer));
- f.Write(buffer, 1, read);
+ f.Write(buffer, 1, read);
}
delete f;
- }
+ }
}
return true;
}
{
return input ? feof(input) : true;
}
-
+
virtual bool Truncate(FileSize size)
{
#ifdef ECERE_BOOTSTRAP
return output ? (_chsize(fileno(output), size) == 0) : false;
#else
return output ? (ftruncate(fileno(output), size) == 0) : false;
- #endif
+ #endif
#endif
}
{
return FILE_GetSize(input);
}
-
+
virtual void CloseInput(void)
{
if(input)
while(c<max-1)
{
char ch = 0;
-
+
if(/*!Peek() || */ !Getc(&ch))
{
result = false;
break;
}
- if(ch =='\n')
+ if(ch =='\n')
break;
if(ch !='\r')
s[c++]=ch;
else
string[c]=ch;
- if(!Getc(&ch))
+ if(!Getc(&ch))
{
c++;
result = false;
- break;
+ break;
}
}
string[c]=0;
set
{
FILE_set_buffered(input, output, value);
- }
+ }
}
property bool eof { get { return Eof(); } }
//if(!result)
{
/* TOFIX:
- LogErrorCode((mode == Read || mode == ReadWrite) ?
+ LogErrorCode((mode == Read || mode == ReadWrite) ?
ERR_FILE_NOT_FOUND : ERR_FILE_WRITE_FAILED, fileName);
*/
}
// TIME_ZONE_INFORMATION tz = { 0 };
SYSTEMTIME st, lt;
DateTime tm;
-
+
tm = t;
st.wYear = (short)tm.year;
result = EARFileSystem::Open(archiveName, archiveFile, mode);
}
#if !defined(ECERE_VANILLA) && !defined(ECERE_NONET)
- else if(strstr(fileName, "http://") == fileName)
+ else if(strstr(fileName, "http://") == fileName || strstr(fileName, "https://"))
{
result = FileOpenURL(fileName);
}
#endif
if(strstr(fileName, "File://") == fileName)
{
- result = (File)strtoul(fileName+7, null, 16);
+ result = (File)(uintptr)strtoull(fileName+7, null, 16);
if(result)
{
if(result._class && eClass_IsDerived(result._class, class(File)))
{
delete file;
/* TOFIX:
- LogErrorCode((mode == Read || mode == ReadWrite) ?
+ LogErrorCode((mode == Read || mode == ReadWrite) ?
ERR_FILE_NOT_FOUND : ERR_FILE_WRITE_FAILED, fileName);
*/
}
if(hFile != INVALID_HANDLE_VALUE)
{
FILETIME c, a, m;
-
+
TimeStampToWin32FileTime(created, &c);
TimeStampToWin32FileTime(accessed, &a);
TimeStampToWin32FileTime(modified, &m);
mm = Win32FileTimeToTimeStamp(&m);
}
*/
-
+
if(SetFileTime(hFile, &c, &a, &m))
result = true;
else
{
Dir d;
-
+
if((d = file.dir = Dir {}))
{
#if defined(__WIN32__)
if(!strcmp(path, "/"))
{
int c;
- d.fHandle = (void *)0xFFFFFFFF; //GetLogicalDrives();
+ uint drives = 0xFFFFFFFF;
+ d.fHandle = (HANDLE)drives; //GetLogicalDrives();
for(c = 0; c<26; c++)
if(((uint)d.fHandle) & (1<<c))
{
case DRIVE_REMOTE: file.stats.attribs.isRemote = true; break;
case DRIVE_CDROM: file.stats.attribs.isCDROM = true; break;
}
- *((uint *)&d.fHandle) ^= (1<<c);
+ drives ^= (1<<c);
if(driveType == DRIVE_NO_ROOT_DIR) continue;
-
- if(driveType != DRIVE_REMOVABLE && driveType != DRIVE_REMOTE &&
+
+ if(driveType != DRIVE_REMOVABLE && driveType != DRIVE_REMOTE &&
GetVolumeInformation(_wfilePath, _wvolume, MAX_FILENAME - 1, null, null, null, null, 0))
{
file.path[2] = '\0';
result = file;
break;
}
+ d.fHandle = (HANDLE) drives;
d.resource = 0;
}
else if(path[0] != '\\' || path[1] != '\\' || strstr(path+2, "\\"))
size = 512 * sizeof(NETRESOURCE);
resources = (NETRESOURCE *)new0 byte[size];
-
+
// Entire Network
WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_DISK, 0, &buffer[c], &handle);
while(true)
if(!strcmp(d.name, "/"))
{
int c;
+ uint drives = (uint)d.fHandle;
for(c = 0; c<26; c++)
{
- if(((uint)d.fHandle) & (1<<c))
+ if(drives & (1<<c))
{
char volume[MAX_FILENAME] = "";
int driveType;
_wpath[2] = path[2] = '\\';
_wpath[3] = path[3] = 0;
driveType = GetDriveType(_wpath);
- *((uint *)&d.fHandle) ^= (1<<c);
+ drives ^= (1<<c);
switch(driveType)
{
_wpath[3] = 0;
}
- if(driveType != DRIVE_REMOVABLE && driveType != DRIVE_REMOTE &&
+ if(driveType != DRIVE_REMOVABLE && driveType != DRIVE_REMOTE &&
GetVolumeInformation(_wpath, _wvolume, MAX_FILENAME - 1, null, null, null, null, 0))
{
UTF16toUTF8Buffer(_wvolume, volume, MAX_FILENAME);
break;
}
}
+ d.fHandle = (HANDLE) drives;
break;
}
else if(d.name[0] != '\\' || d.name[1] != '\\' || strstr(d.name+2, "\\"))
break;
countInGroup = 0xFFFFFFFF;
resources = (NETRESOURCE *)renew0 resources byte[size];
-
+
}
WNetCloseEnum(handle);
d.numResources = countInGroup;
}
else
{
- if(d.resources)
+ if(d.resources)
delete d.resources;
}
}
//strcpy(buffer, template);
strcat(buffer, "XXXXXX");
// mktemp(buffer);
- fd = mkstemp(buffer);
+ fd = mkstemp(buffer);
strcpy(tempFileName, buffer);
f = { };
f.output = f.input = fdopen(fd, "r+");
GetTempPathA(MAX_LOCATION, tempPath); // TODO: Patch this whole thing to support Unicode temp path
GetTempFileNameA(tempPath, template, 0, tempFileName);
f = FileOpen(tempFileName, readWrite);
-#endif
+#endif
return f;
#endif
}