DefineDosDeviceW: implemented the DDD_REMOVE_DEFINITION flag.
This commit is contained in:
parent
115862146a
commit
74f583ed19
|
@ -936,25 +936,29 @@ BOOL WINAPI DefineDosDeviceW( DWORD flags, LPCWSTR devname, LPCWSTR targetpath )
|
||||||
BOOL ret = FALSE;
|
BOOL ret = FALSE;
|
||||||
char *path = NULL, *target, *p;
|
char *path = NULL, *target, *p;
|
||||||
|
|
||||||
if (!(flags & DDD_RAW_TARGET_PATH))
|
if (!(flags & DDD_REMOVE_DEFINITION))
|
||||||
{
|
{
|
||||||
FIXME( "(0x%08lx,%s,%s) DDD_RAW_TARGET_PATH flag not set, not supported yet\n",
|
if (!(flags & DDD_RAW_TARGET_PATH))
|
||||||
flags, debugstr_w(devname), debugstr_w(targetpath) );
|
{
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
FIXME( "(0x%08lx,%s,%s) DDD_RAW_TARGET_PATH flag not set, not supported yet\n",
|
||||||
return FALSE;
|
flags, debugstr_w(devname), debugstr_w(targetpath) );
|
||||||
}
|
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
len = WideCharToMultiByte( CP_UNIXCP, 0, targetpath, -1, NULL, 0, NULL, NULL );
|
len = WideCharToMultiByte( CP_UNIXCP, 0, targetpath, -1, NULL, 0, NULL, NULL );
|
||||||
if ((target = HeapAlloc( GetProcessHeap(), 0, len )))
|
if ((target = HeapAlloc( GetProcessHeap(), 0, len )))
|
||||||
{
|
{
|
||||||
WideCharToMultiByte( CP_UNIXCP, 0, targetpath, -1, target, len, NULL, NULL );
|
WideCharToMultiByte( CP_UNIXCP, 0, targetpath, -1, target, len, NULL, NULL );
|
||||||
for (p = target; *p; p++) if (*p == '\\') *p = '/';
|
for (p = target; *p; p++) if (*p == '\\') *p = '/';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
SetLastError( ERROR_NOT_ENOUGH_MEMORY );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else target = NULL;
|
||||||
|
|
||||||
/* first check for a DOS device */
|
/* first check for a DOS device */
|
||||||
|
|
||||||
|
@ -974,13 +978,22 @@ BOOL WINAPI DefineDosDeviceW( DWORD flags, LPCWSTR devname, LPCWSTR targetpath )
|
||||||
|
|
||||||
if (path)
|
if (path)
|
||||||
{
|
{
|
||||||
TRACE( "creating symlink %s -> %s\n", path, target );
|
if (target)
|
||||||
unlink( path );
|
{
|
||||||
if (!symlink( target, path )) ret = TRUE;
|
TRACE( "creating symlink %s -> %s\n", path, target );
|
||||||
else FILE_SetDosError();
|
unlink( path );
|
||||||
|
if (!symlink( target, path )) ret = TRUE;
|
||||||
|
else FILE_SetDosError();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TRACE( "removing symlink %s\n", path );
|
||||||
|
if (!unlink( path )) ret = TRUE;
|
||||||
|
else FILE_SetDosError();
|
||||||
|
}
|
||||||
HeapFree( GetProcessHeap(), 0, path );
|
HeapFree( GetProcessHeap(), 0, path );
|
||||||
}
|
}
|
||||||
HeapFree( GetProcessHeap(), 0, target );
|
if (target) HeapFree( GetProcessHeap(), 0, target );
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue