Exemple #1
0
void WinePathToUnix(String* Dest, String* Sorc, String* WineDir)
{
    int i;
    String TempStr;
    String_Ctor(& TempStr);
    
    if(Sorc -> Data[1] != ':')
    {
        String_From(Dest, Sorc);
        String_Dtor(& TempStr);
        return;
    }

    for(i = 0; i < String_GetLength(Sorc); i ++)
        if(Sorc -> Data[i] == '\\')
            Sorc -> Data[i] = '/';
    if(Sorc -> Data[0] == 'Z')
    {
        MidFrom(Dest, Sorc, 2);
    }else
    {
        char DriveNo[2];
        DriveNo[0] = tolower(Sorc -> Data[0]);
        DriveNo[1] = '\0';
        String_From(Dest, WineDir);
        String_JoinChars(Dest, "/drive_");
        String_JoinChars(Dest, (char*)DriveNo);
        MidFrom(& TempStr, Sorc, 2);
        String_Join(Dest, & TempStr);
    }
    
    String_Dtor(& TempStr);    
}
Exemple #2
0
VOID
PushAddToFileList( FILE_LIST* FileList, FILE_LIST_ENTRY *FileEntry )
{
    FILE_LIST_ENTRY *fileListEntry;
    WCHAR *name;

    name = (WCHAR*)Memory_Allocate(
            /*PushHeapHandle,
            0,*/
            (String_GetLength(FileEntry->Name) + 1) * sizeof(WCHAR)
            );

    String_Copy(name, FileEntry->Name);

    if (*FileList == NULL)
    {
        FILE_LIST_ENTRY *fileList;

        *FileList = (FILE_LIST)Memory_Allocate(
            /*PushHeapHandle,
            0,*/
            sizeof(FILE_LIST_ENTRY)
            );

        fileList = *FileList;

        fileList->NextEntry = NULL;
        fileList->Bytes = FileEntry->Bytes;
        fileList->Name = name;
        fileList->Cache = FileEntry->Cache;

        return;
    }

    fileListEntry = (FILE_LIST_ENTRY*) *FileList;

    while (fileListEntry->NextEntry != 0)
    {
        fileListEntry = fileListEntry->NextEntry;
    }

    fileListEntry->NextEntry = (FILE_LIST_ENTRY *)Memory_Allocate(
        /*PushHeapHandle,
        0,*/
        sizeof(FILE_LIST_ENTRY)
        );

    fileListEntry = fileListEntry->NextEntry;

    fileListEntry->Bytes = FileEntry->Bytes;
    fileListEntry->Name = name;
    fileListEntry->Cache = FileEntry->Cache;
    fileListEntry->NextEntry = 0;
}
Exemple #3
0
UINT32 ListView_GetHeaderWidth( UINT8 Column )
{
    WCHAR columnText[260];
    HANDLE deviceContext;
    SIZE size;

    deviceContext = GetDC(ListView_Handle);

    ListView_GetColumnText(Column, columnText);

    GetTextExtentPoint32W(
        deviceContext,
        columnText,
        String_GetLength(columnText),
        &size
        );

    ReleaseDC(ListView_Handle, deviceContext);

    return size.cx;
}
Exemple #4
0
UINT8 ListView_GetItemText(
    UINT16 Item,
    UINT8 SubItem,
    WCHAR* Text,
    UINT16 TextLength
    )
{
    LVITEMW item;
    unsigned __int8 length;

    item.Mask = LVIF_TEXT;
    item.Item = Item;
    item.SubItem = SubItem;
    item.Text = Text;
    item.TextMax = TextLength;

    SendMessageW(ListView_Handle, LVM_GETITEM, 0, (LONG)&item);

    length = String_GetLength(item.Text);

    return length;
}
Exemple #5
0
VOID CacheFile( WCHAR *FileName, CHAR cMountPoint )
{
    WCHAR destination[260];
    WCHAR *pszFileName;
    CHAR bMarkedForCaching = FALSE;
    WCHAR* slash;
    WCHAR deviceName[260], dosName[260];
    HANDLE directoryHandle;
    HANDLE linkHandle;
    OBJECT_ATTRIBUTES objAttrib;
    UNICODE_STRING directoryName;
    UNICODE_STRING driveLetter;
    UNICODE_STRING linkTarget;

    destination[0] = cMountPoint;
    destination[1] = ':';
    destination[2] = '\\';
    destination[3] = '\0';

    pszFileName = String_FindLastChar(FileName, '\\') + 1;

    if (!bMarkedForCaching)
        // file was a member of a folder marked for caching
    {
        String_Concatenate(destination, g_szLastDir);
        String_Concatenate(destination, L"\\");
    }

    String_Concatenate(destination, pszFileName);
    File_Copy(FileName, destination, CopyProgress);
    String_Copy(dosName, FileName);

    slash = String_FindFirstChar(dosName, '\\');
    *slash = L'\0';

    UnicodeString_Init(&directoryName, L"\\??");

    objAttrib.Length = sizeof(OBJECT_ATTRIBUTES);
    objAttrib.RootDirectory = NULL;
    objAttrib.ObjectName = &directoryName;
    objAttrib.Attributes = OBJ_CASE_INSENSITIVE;
    objAttrib.SecurityDescriptor = NULL;
    objAttrib.SecurityQualityOfService = NULL;

    NtOpenDirectoryObject(&directoryHandle, DIRECTORY_QUERY, &objAttrib);

    UnicodeString_Init(&driveLetter, dosName);

    objAttrib.Length = sizeof(OBJECT_ATTRIBUTES);
    objAttrib.RootDirectory = directoryHandle;
    objAttrib.ObjectName = &driveLetter;
    objAttrib.Attributes = OBJ_CASE_INSENSITIVE;
    objAttrib.SecurityDescriptor = NULL;
    objAttrib.SecurityQualityOfService = NULL;

    NtOpenSymbolicLinkObject(&linkHandle, SYMBOLIC_LINK_QUERY, &objAttrib);

    linkTarget.Length = 0;
    linkTarget.MaximumLength = 260 * sizeof(WCHAR);
    linkTarget.Buffer = deviceName;

    NtQuerySymbolicLinkObject(linkHandle, &linkTarget, NULL);

    deviceName[linkTarget.Length / sizeof(WCHAR)] = L'\0';

    String_Concatenate(deviceName, L"\\");
    String_Concatenate(deviceName, slash + 1);

    R0QueueFile(
        deviceName,
        String_GetLength(deviceName) + 1
             );
}