Skip to content

Commit

Permalink
Merge branch 'awakecoding' of https://github.com/vworkspace/FreeRDP
Browse files Browse the repository at this point in the history
Conflicts:
	channels/rdpdr/server/rdpdr_main.c
  • Loading branch information
awakecoding committed May 20, 2015
2 parents 4c5ac6c + b6cb94b commit 7e1dbd5
Show file tree
Hide file tree
Showing 11 changed files with 1,597 additions and 76 deletions.
1,303 changes: 1,234 additions & 69 deletions channels/rdpdr/server/rdpdr_main.c

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions channels/rdpdr/server/rdpdr_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* FreeRDP: A Remote Desktop Protocol Implementation
* Device Redirection Virtual Channel Extension
*
* Copyright 2014 Dell Software <Mike.McDonald@software.dell.com>
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -20,6 +21,7 @@
#ifndef FREERDP_CHANNEL_SERVER_RDPDR_MAIN_H
#define FREERDP_CHANNEL_SERVER_RDPDR_MAIN_H

#include <winpr/collections.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/thread.h>
Expand All @@ -39,6 +41,9 @@ struct _rdpdr_server_private
char* ClientComputerName;

BOOL UserLoggedOnPdu;

wListDictionary* IrpList;
UINT32 NextCompletionId;
};

#define RDPDR_HEADER_LENGTH 4
Expand Down Expand Up @@ -67,4 +72,16 @@ struct _RDPDR_CAPABILITY_HEADER
};
typedef struct _RDPDR_CAPABILITY_HEADER RDPDR_CAPABILITY_HEADER;

struct _RDPDR_IRP
{
UINT32 CompletionId;
UINT32 DeviceId;
UINT32 FileId;
char PathName[256];
char ExtraBuffer[256];
void *CallbackData;
void (*Callback)(RdpdrServerContext* context, wStream* s, struct _RDPDR_IRP* irp, UINT32 deviceId, UINT32 completionId, UINT32 ioStatus);
};
typedef struct _RDPDR_IRP RDPDR_IRP;

#endif /* FREERDP_CHANNEL_SERVER_RDPDR_MAIN_H */
92 changes: 92 additions & 0 deletions include/freerdp/server/rdpdr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* FreeRDP: A Remote Desktop Protocol Implementation
* Device Redirection Virtual Channel Server Interface
*
* Copyright 2014 Dell Software <Mike.McDonald@software.dell.com>
* Copyright 2013 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -32,9 +33,55 @@
typedef struct _rdpdr_server_context RdpdrServerContext;
typedef struct _rdpdr_server_private RdpdrServerPrivate;

struct _FILE_DIRECTORY_INFORMATION
{
UINT32 NextEntryOffset;
UINT32 FileIndex;
UINT64 CreationTime;
UINT64 LastAccessTime;
UINT64 LastWriteTime;
UINT64 ChangeTime;
UINT64 EndOfFile;
UINT64 AllocationSize;
UINT32 FileAttributes;
char FileName[512];
};
typedef struct _FILE_DIRECTORY_INFORMATION FILE_DIRECTORY_INFORMATION;

typedef int (*psRdpdrStart)(RdpdrServerContext* context);
typedef int (*psRdpdrStop)(RdpdrServerContext* context);

typedef BOOL (*psRdpdrDriveCreateDirectory)(RdpdrServerContext* context, void* callbackData, UINT32 deviceId, const char* path);
typedef BOOL (*psRdpdrDriveDeleteDirectory)(RdpdrServerContext* context, void* callbackData, UINT32 deviceId, const char* path);
typedef BOOL (*psRdpdrDriveQueryDirectory)(RdpdrServerContext* context, void* callbackData, UINT32 deviceId, const char* path);
typedef BOOL (*psRdpdrDriveOpenFile)(RdpdrServerContext* context, void* callbackData, UINT32 deviceId, const char* path, UINT32 desiredAccess, UINT32 createDisposition);
typedef BOOL (*psRdpdrDriveReadFile)(RdpdrServerContext* context, void* callbackData, UINT32 deviceId, UINT32 fileId, UINT32 length, UINT32 offset);
typedef BOOL (*psRdpdrDriveWriteFile)(RdpdrServerContext* context, void* callbackData, UINT32 deviceId, UINT32 fileId, const char* buffer, UINT32 length, UINT32 offset);
typedef BOOL (*psRdpdrDriveCloseFile)(RdpdrServerContext* context, void* callbackData, UINT32 deviceId, UINT32 fileId);
typedef BOOL (*psRdpdrDriveDeleteFile)(RdpdrServerContext* context, void* callbackData, UINT32 deviceId, const char* path);
typedef BOOL (*psRdpdrDriveRenameFile)(RdpdrServerContext* context, void* callbackData, UINT32 deviceId, const char* oldPath, const char* newPath);

typedef void (*psRdpdrOnDriveCreate)(RdpdrServerContext* context, UINT32 deviceId, const char* name);
typedef void (*psRdpdrOnDriveDelete)(RdpdrServerContext* context, UINT32 deviceId);
typedef void (*psRdpdrOnDriveCreateDirectoryComplete)(RdpdrServerContext* context, void* callbackData, UINT32 ioStatus);
typedef void (*psRdpdrOnDriveDeleteDirectoryComplete)(RdpdrServerContext* context, void* callbackData, UINT32 ioStatus);
typedef void (*psRdpdrOnDriveQueryDirectoryComplete)(RdpdrServerContext* context, void* callbackData, UINT32 ioStatus, FILE_DIRECTORY_INFORMATION* fdi);
typedef void (*psRdpdrOnDriveOpenFileComplete)(RdpdrServerContext* context, void* callbackData, UINT32 ioStatus, UINT32 deviceId, UINT32 fileId);
typedef void (*psRdpdrOnDriveReadFileComplete)(RdpdrServerContext* context, void* callbackData, UINT32 ioStatus, const char* buffer, UINT32 length);
typedef void (*psRdpdrOnDriveWriteFileComplete)(RdpdrServerContext* context, void* callbackData, UINT32 ioStatus, UINT32 bytesWritten);
typedef void (*psRdpdrOnDriveCloseFileComplete)(RdpdrServerContext* context, void* callbackData, UINT32 ioStatus);
typedef void (*psRdpdrOnDriveDeleteFileComplete)(RdpdrServerContext* context, void* callbackData, UINT32 ioStatus);
typedef void (*psRdpdrOnDriveRenameFileComplete)(RdpdrServerContext* context, void* callbackData, UINT32 ioStatus);

typedef void (*psRdpdrOnPortCreate)(RdpdrServerContext* context, UINT32 deviceId, const char* name);
typedef void (*psRdpdrOnPortDelete)(RdpdrServerContext* context, UINT32 deviceId);

typedef void (*psRdpdrOnPrinterCreate)(RdpdrServerContext* context, UINT32 deviceId, const char* name);
typedef void (*psRdpdrOnPrinterDelete)(RdpdrServerContext* context, UINT32 deviceId);

typedef void (*psRdpdrOnSmartcardCreate)(RdpdrServerContext* context, UINT32 deviceId, const char* name);
typedef void (*psRdpdrOnSmartcardDelete)(RdpdrServerContext* context, UINT32 deviceId);

struct _rdpdr_server_context
{
HANDLE vcm;
Expand All @@ -43,6 +90,51 @@ struct _rdpdr_server_context
psRdpdrStop Stop;

RdpdrServerPrivate* priv;

/* Server self-defined pointer. */
void* data;

/* Server supported redirections. Set by server. */
BOOL supportsDrives;
BOOL supportsPorts;
BOOL supportsPrinters;
BOOL supportsSmartcards;

/*** Drive APIs called by the server. ***/
psRdpdrDriveCreateDirectory DriveCreateDirectory;
psRdpdrDriveDeleteDirectory DriveDeleteDirectory;
psRdpdrDriveQueryDirectory DriveQueryDirectory;
psRdpdrDriveOpenFile DriveOpenFile;
psRdpdrDriveReadFile DriveReadFile;
psRdpdrDriveWriteFile DriveWriteFile;
psRdpdrDriveCloseFile DriveCloseFile;
psRdpdrDriveDeleteFile DriveDeleteFile;
psRdpdrDriveRenameFile DriveRenameFile;

/*** Drive callbacks registered by the server. ***/
psRdpdrOnDriveCreate OnDriveCreate;
psRdpdrOnDriveDelete OnDriveDelete;
psRdpdrOnDriveCreateDirectoryComplete OnDriveCreateDirectoryComplete;
psRdpdrOnDriveDeleteDirectoryComplete OnDriveDeleteDirectoryComplete;
psRdpdrOnDriveQueryDirectoryComplete OnDriveQueryDirectoryComplete;
psRdpdrOnDriveOpenFileComplete OnDriveOpenFileComplete;
psRdpdrOnDriveReadFileComplete OnDriveReadFileComplete;
psRdpdrOnDriveWriteFileComplete OnDriveWriteFileComplete;
psRdpdrOnDriveCloseFileComplete OnDriveCloseFileComplete;
psRdpdrOnDriveDeleteFileComplete OnDriveDeleteFileComplete;
psRdpdrOnDriveRenameFileComplete OnDriveRenameFileComplete;

/*** Port callbacks registered by the server. ***/
psRdpdrOnPortCreate OnPortCreate;
psRdpdrOnPortDelete OnPortDelete;

/*** Printer callbacks registered by the server. ***/
psRdpdrOnPrinterCreate OnPrinterCreate;
psRdpdrOnPrinterDelete OnPrinterDelete;

/*** Smartcard callbacks registered by the server. ***/
psRdpdrOnSmartcardCreate OnSmartcardCreate;
psRdpdrOnSmartcardDelete OnSmartcardDelete;
};

#ifdef __cplusplus
Expand Down
19 changes: 15 additions & 4 deletions libfreerdp/core/capabilities.c
Original file line number Diff line number Diff line change
Expand Up @@ -2685,10 +2685,21 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
Stream_Read_UINT8(s, transformBits); /* transformBits (1 byte) */
Stream_Read_UINT8(s, entropyBits); /* entropyBits (1 byte) */

if (version != 0x0100)
return FALSE;

if (tileSize != 0x0040)
if (version == 0x0009)
{
/* Version 0.9 */

if (tileSize != 0x0080)
return FALSE;
}
else if (version == 0x0100)
{
/* Version 1.0 */

if (tileSize != 0x0040)
return FALSE;
}
else
return FALSE;

if (colConvBits != 1)
Expand Down
2 changes: 1 addition & 1 deletion libfreerdp/core/peer.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static HANDLE freerdp_peer_virtual_channel_open(freerdp_peer* client, const char
if (!mcsChannel->joined)
continue;

if (strncmp(name, mcsChannel->Name, length) == 0)
if (_strnicmp(name, mcsChannel->Name, length) == 0)
{
joined = TRUE;
break;
Expand Down
52 changes: 52 additions & 0 deletions winpr/include/winpr/shell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* WinPR: Windows Portable Runtime
* Shell Functions
*
* Copyright 2015 Dell Software <Mike.McDonald@software.dell.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef WINPR_SHELL_H
#define WINPR_SHELL_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winpr/winpr.h>
#include <winpr/wtypes.h>

#ifndef _WIN32

#ifdef __cplusplus
extern "C" {
#endif

WINPR_API BOOL GetUserProfileDirectoryA(HANDLE hToken, LPSTR lpProfileDir, LPDWORD lpcchSize);

WINPR_API BOOL GetUserProfileDirectoryW(HANDLE hToken, LPWSTR lpProfileDir, LPDWORD lpcchSize);

#ifdef __cplusplus
}
#endif

#ifdef UNICODE
#define GetUserProfileDirectory GetUserProfileDirectoryW
#else
#define GetUserProfileDirectory GetUserProfileDirectoryA
#endif

#endif

#endif /* WINPR_SHELL_H */

2 changes: 1 addition & 1 deletion winpr/libwinpr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ endmacro()

# Level "1" API as defined for MinCore.lib
set(WINPR_CORE synch locale library file comm pipe interlocked security
environment crypto registry credentials path io memory input
environment crypto registry credentials path io memory input shell
heap utils error com timezone sysinfo pool handle thread)

foreach(DIR ${WINPR_CORE})
Expand Down
18 changes: 18 additions & 0 deletions winpr/libwinpr/shell/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# WinPR: Windows Portable Runtime
# libwinpr-shell cmake build script
#
# Copyright 2015 Dell Software <Mike.McDonald@software.dell.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

winpr_module_add(shell.c)
9 changes: 9 additions & 0 deletions winpr/libwinpr/shell/ModuleOptions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

set(MINWIN_LAYER "0")
set(MINWIN_GROUP "none")
set(MINWIN_MAJOR_VERSION "0")
set(MINWIN_MINOR_VERSION "0")
set(MINWIN_SHORT_NAME "shell")
set(MINWIN_LONG_NAME "Shell Functions")
set(MODULE_LIBRARY_NAME "${MINWIN_SHORT_NAME}")

Loading

0 comments on commit 7e1dbd5

Please sign in to comment.