mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 04:07:16 +00:00
* Sync up to trunk head (r64939).
svn path=/branches/shell-experiments/; revision=64941
This commit is contained in:
commit
8039ce5b7d
27 changed files with 1252 additions and 860 deletions
|
@ -10,6 +10,7 @@ list(APPEND SOURCE
|
|||
cmdPause.c
|
||||
cmdStart.c
|
||||
cmdStop.c
|
||||
cmdUser.c
|
||||
help.c
|
||||
net.h)
|
||||
|
||||
|
|
348
base/applications/network/net/cmdUser.c
Normal file
348
base/applications/network/net/cmdUser.c
Normal file
|
@ -0,0 +1,348 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS net command
|
||||
* FILE:
|
||||
* PURPOSE:
|
||||
*
|
||||
* PROGRAMMERS: Eric Kohl
|
||||
*/
|
||||
|
||||
#include "net.h"
|
||||
|
||||
|
||||
static
|
||||
int
|
||||
CompareInfo(const void *a,
|
||||
const void *b)
|
||||
{
|
||||
return _wcsicmp(((PUSER_INFO_0)a)->usri0_name,
|
||||
((PUSER_INFO_0)b)->usri0_name);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
NET_API_STATUS
|
||||
EnumerateUsers(VOID)
|
||||
{
|
||||
PUSER_INFO_0 pBuffer = NULL;
|
||||
PSERVER_INFO_100 pServer = NULL;
|
||||
DWORD dwRead = 0, dwTotal = 0;
|
||||
DWORD i;
|
||||
DWORD_PTR ResumeHandle = 0;
|
||||
NET_API_STATUS Status;
|
||||
|
||||
Status = NetServerGetInfo(NULL,
|
||||
100,
|
||||
(LPBYTE*)&pServer);
|
||||
if (Status != NERR_Success)
|
||||
return Status;
|
||||
|
||||
printf("\nUser accounts for \\\\%S\n\n", pServer->sv100_name);
|
||||
|
||||
NetApiBufferFree(pServer);
|
||||
|
||||
printf("------------------------------------------\n");
|
||||
|
||||
Status = NetUserEnum(NULL,
|
||||
0,
|
||||
0,
|
||||
(LPBYTE*)&pBuffer,
|
||||
MAX_PREFERRED_LENGTH,
|
||||
&dwRead,
|
||||
&dwTotal,
|
||||
&ResumeHandle);
|
||||
if (Status != NERR_Success)
|
||||
return Status;
|
||||
|
||||
qsort(pBuffer,
|
||||
dwRead,
|
||||
sizeof(PUSER_INFO_0),
|
||||
CompareInfo);
|
||||
|
||||
// printf("dwRead: %lu dwTotal: %lu\n", dwRead, dwTotal);
|
||||
for (i = 0; i < dwRead; i++)
|
||||
{
|
||||
// printf("%p\n", pBuffer[i].lgrpi0_name);
|
||||
if (pBuffer[i].usri0_name)
|
||||
printf("%S\n", pBuffer[i].usri0_name);
|
||||
}
|
||||
|
||||
NetApiBufferFree(pBuffer);
|
||||
|
||||
return NERR_Success;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
VOID
|
||||
PrintDateTime(DWORD dwSeconds)
|
||||
{
|
||||
LARGE_INTEGER Time;
|
||||
FILETIME FileTime;
|
||||
SYSTEMTIME SystemTime;
|
||||
WCHAR DateBuffer[80];
|
||||
WCHAR TimeBuffer[80];
|
||||
|
||||
RtlSecondsSince1970ToTime(dwSeconds, &Time);
|
||||
FileTime.dwLowDateTime = Time.u.LowPart;
|
||||
FileTime.dwHighDateTime = Time.u.HighPart;
|
||||
FileTimeToSystemTime(&FileTime, &SystemTime);
|
||||
|
||||
GetDateFormatW(LOCALE_USER_DEFAULT,
|
||||
DATE_SHORTDATE,
|
||||
&SystemTime,
|
||||
NULL,
|
||||
DateBuffer,
|
||||
80);
|
||||
|
||||
GetTimeFormatW(LOCALE_USER_DEFAULT,
|
||||
TIME_NOSECONDS,
|
||||
&SystemTime,
|
||||
NULL,
|
||||
TimeBuffer,
|
||||
80);
|
||||
|
||||
printf("%S %S\n", DateBuffer, TimeBuffer);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
NET_API_STATUS
|
||||
DisplayUser(LPWSTR lpUserName)
|
||||
{
|
||||
PUSER_INFO_4 pUserInfo = NULL;
|
||||
NET_API_STATUS Status;
|
||||
|
||||
/* Modify the user */
|
||||
Status = NetUserGetInfo(NULL,
|
||||
lpUserName,
|
||||
4,
|
||||
(LPBYTE*)&pUserInfo);
|
||||
if (Status != NERR_Success)
|
||||
return Status;
|
||||
|
||||
printf("User name %S\n", pUserInfo->usri4_name);
|
||||
printf("Full name %S\n", pUserInfo->usri4_full_name);
|
||||
printf("Comment %S\n", pUserInfo->usri4_comment);
|
||||
printf("User comment %S\n", pUserInfo->usri4_usr_comment);
|
||||
printf("Country code %03ld ()\n", pUserInfo->usri4_country_code);
|
||||
printf("Account active %S\n", (pUserInfo->usri4_flags & UF_ACCOUNTDISABLE)? L"No" : ((pUserInfo->usri4_flags & UF_LOCKOUT) ? L"Locked" : L"Yes"));
|
||||
printf("Account expires ");
|
||||
if (pUserInfo->usri4_acct_expires == TIMEQ_FOREVER)
|
||||
printf("Never\n");
|
||||
else
|
||||
PrintDateTime(pUserInfo->usri4_acct_expires);
|
||||
|
||||
printf("\n");
|
||||
printf("Password last set \n");
|
||||
printf("Password expires \n");
|
||||
printf("Password changeable \n");
|
||||
printf("Password required \n");
|
||||
printf("User may change password \n");
|
||||
printf("\n");
|
||||
printf("Workstation allowed %S\n", pUserInfo->usri4_workstations);
|
||||
printf("Logon script %S\n", pUserInfo->usri4_script_path);
|
||||
printf("User profile %S\n", pUserInfo->usri4_profile);
|
||||
printf("Home directory %S\n", pUserInfo->usri4_home_dir);
|
||||
printf("Last logon ");
|
||||
if (pUserInfo->usri4_last_logon == 0)
|
||||
printf("Never\n");
|
||||
else
|
||||
PrintDateTime(pUserInfo->usri4_last_logon);
|
||||
printf("\n");
|
||||
printf("Logon hours allowed \n");
|
||||
printf("\n");
|
||||
printf("Local group memberships \n");
|
||||
printf("Global group memberships \n");
|
||||
|
||||
if (pUserInfo != NULL)
|
||||
NetApiBufferFree(pUserInfo);
|
||||
|
||||
return NERR_Success;
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
cmdUser(
|
||||
INT argc,
|
||||
WCHAR **argv)
|
||||
{
|
||||
INT i, j;
|
||||
INT result = 0;
|
||||
BOOL bAdd = FALSE;
|
||||
BOOL bDelete = FALSE;
|
||||
#if 0
|
||||
BOOL bDomain = FALSE;
|
||||
#endif
|
||||
LPWSTR lpUserName = NULL;
|
||||
LPWSTR lpPassword = NULL;
|
||||
PUSER_INFO_4 pUserInfo = NULL;
|
||||
USER_INFO_4 UserInfo;
|
||||
NET_API_STATUS Status;
|
||||
|
||||
if (argc == 2)
|
||||
{
|
||||
Status = EnumerateUsers();
|
||||
printf("Status: %lu\n", Status);
|
||||
return 0;
|
||||
}
|
||||
else if (argc == 3)
|
||||
{
|
||||
Status = DisplayUser(argv[2]);
|
||||
printf("Status: %lu\n", Status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
i = 2;
|
||||
if (argv[i][0] != L'/')
|
||||
{
|
||||
lpUserName = argv[i];
|
||||
printf("User: %S\n", lpUserName);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (argv[i][0] != L'/')
|
||||
{
|
||||
lpPassword = argv[i];
|
||||
printf("Password: %S\n", lpPassword);
|
||||
i++;
|
||||
}
|
||||
|
||||
for (j = i; j < argc; j++)
|
||||
{
|
||||
if (_wcsicmp(argv[j], L"/help") == 0)
|
||||
{
|
||||
PrintResourceString(IDS_USER_HELP);
|
||||
return 0;
|
||||
}
|
||||
else if (_wcsicmp(argv[j], L"/add") == 0)
|
||||
{
|
||||
bAdd = TRUE;
|
||||
}
|
||||
else if (_wcsicmp(argv[j], L"/delete") == 0)
|
||||
{
|
||||
bDelete = TRUE;
|
||||
}
|
||||
else if (_wcsicmp(argv[j], L"/domain") == 0)
|
||||
{
|
||||
printf("The /DOMAIN option is not supported yet!\n");
|
||||
#if 0
|
||||
bDomain = TRUE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (bAdd && bDelete)
|
||||
{
|
||||
result = 1;
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!bAdd && !bDelete)
|
||||
{
|
||||
/* Modify the user */
|
||||
Status = NetUserGetInfo(NULL,
|
||||
lpUserName,
|
||||
4,
|
||||
(LPBYTE*)&pUserInfo);
|
||||
printf("Status: %lu\n", Status);
|
||||
}
|
||||
else if (bAdd && !bDelete)
|
||||
{
|
||||
/* Add the user */
|
||||
ZeroMemory(&UserInfo, sizeof(USER_INFO_4));
|
||||
|
||||
UserInfo.usri4_name = lpUserName;
|
||||
UserInfo.usri4_password = lpPassword;
|
||||
UserInfo.usri4_flags = UF_SCRIPT | UF_NORMAL_ACCOUNT;
|
||||
|
||||
pUserInfo = &UserInfo;
|
||||
}
|
||||
|
||||
for (j = i; j < argc; j++)
|
||||
{
|
||||
if (_wcsnicmp(argv[j], L"/active:", 8) == 0)
|
||||
{
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/comment:", 9) == 0)
|
||||
{
|
||||
pUserInfo->usri4_comment = &argv[j][9];
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/countrycode:", 13) == 0)
|
||||
{
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/expires:", 9) == 0)
|
||||
{
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/fullname:", 10) == 0)
|
||||
{
|
||||
pUserInfo->usri4_full_name = &argv[j][10];
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/homedir:", 9) == 0)
|
||||
{
|
||||
pUserInfo->usri4_home_dir = &argv[j][9];
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/passwordchg:", 13) == 0)
|
||||
{
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/passwordreq:", 13) == 0)
|
||||
{
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/profilepath:", 13) == 0)
|
||||
{
|
||||
pUserInfo->usri4_profile = &argv[j][13];
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/scriptpath:", 12) == 0)
|
||||
{
|
||||
pUserInfo->usri4_script_path = &argv[j][12];
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/times:", 7) == 0)
|
||||
{
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/usercomment:", 13) == 0)
|
||||
{
|
||||
pUserInfo->usri4_usr_comment = &argv[j][13];
|
||||
}
|
||||
else if (_wcsnicmp(argv[j], L"/workstations:", 14) == 0)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (!bAdd && !bDelete)
|
||||
{
|
||||
/* Modify the user */
|
||||
Status = NetUserSetInfo(NULL,
|
||||
lpUserName,
|
||||
4,
|
||||
(LPBYTE)pUserInfo,
|
||||
NULL);
|
||||
printf("Status: %lu\n", Status);
|
||||
}
|
||||
else if (bAdd && !bDelete)
|
||||
{
|
||||
/* Add the user */
|
||||
Status = NetUserAdd(NULL,
|
||||
4,
|
||||
(LPBYTE)pUserInfo,
|
||||
NULL);
|
||||
printf("Status: %lu\n", Status);
|
||||
}
|
||||
else if (!bAdd && bDelete)
|
||||
{
|
||||
/* Delete the user */
|
||||
Status = NetUserDel(NULL,
|
||||
lpUserName);
|
||||
printf("Status: %lu\n", Status);
|
||||
}
|
||||
|
||||
done:
|
||||
if (!bAdd && !bDelete && pUserInfo != NULL)
|
||||
NetApiBufferFree(pUserInfo);
|
||||
|
||||
if (result != 0)
|
||||
PrintResourceString(IDS_USER_SYNTAX);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -44,7 +44,9 @@ BEGIN
|
|||
IDS_TIME_HELP "TIME\n..."
|
||||
IDS_USE_SYNTAX "Usage:\nNET USE ..."
|
||||
IDS_USE_HELP "USE\n..."
|
||||
IDS_USER_SYNTAX "Usage:\nNET USER ..."
|
||||
IDS_USER_SYNTAX "Usage:\nNET USER [username [password | *] [options]] [/DOMAIN]\n\
|
||||
username {password | *} /ADD [options] [/DOMAIN]\n\
|
||||
username [/DELETE] [/DOMAIN]"
|
||||
IDS_USER_HELP "USER\n..."
|
||||
IDS_VIEW_SYNTAX "Usage:\nNET VIEW ..."
|
||||
IDS_VIEW_HELP "VIEW\n..."
|
||||
|
|
|
@ -50,7 +50,9 @@ BEGIN
|
|||
IDS_TIME_HELP "TIME\n..."
|
||||
IDS_USE_SYNTAX "Utilizare:\nNET USE ..."
|
||||
IDS_USE_HELP "USE\n..."
|
||||
IDS_USER_SYNTAX "Utilizare:\nNET USER ..."
|
||||
IDS_USER_SYNTAX "Utilizare:\nNET USER [username [password | *] [options]] [/DOMAIN]\n\
|
||||
username {password | *} /ADD [options] [/DOMAIN]\n\
|
||||
username [/DELETE] [/DOMAIN]"
|
||||
IDS_USER_HELP "USER\n..."
|
||||
IDS_VIEW_SYNTAX "Utilizare:\nNET VIEW ..."
|
||||
IDS_VIEW_HELP "VIEW\n..."
|
||||
|
|
|
@ -45,7 +45,9 @@ BEGIN
|
|||
IDS_TIME_HELP "TIME\n..."
|
||||
IDS_USE_SYNTAX "Использование:\nNET USE ..."
|
||||
IDS_USE_HELP "USE\n..."
|
||||
IDS_USER_SYNTAX "Использование:\nNET USER ..."
|
||||
IDS_USER_SYNTAX "Использование:\nNET USER [username [password | *] [options]] [/DOMAIN]\n\
|
||||
username {password | *} /ADD [options] [/DOMAIN]\n\
|
||||
username [/DELETE] [/DOMAIN]"
|
||||
IDS_USER_HELP "USER\n..."
|
||||
IDS_VIEW_SYNTAX "Использование:\nNET VIEW ..."
|
||||
IDS_VIEW_HELP "VIEW\n..."
|
||||
|
|
|
@ -40,7 +40,7 @@ COMMAND cmds[] =
|
|||
{L"stop", cmdStop},
|
||||
{L"time", unimplemented},
|
||||
{L"use", unimplemented},
|
||||
{L"user", unimplemented},
|
||||
{L"user", cmdUser},
|
||||
{L"view", unimplemented},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winnls.h>
|
||||
#include <winuser.h>
|
||||
#include <winsvc.h>
|
||||
#include <stdio.h>
|
||||
|
@ -39,5 +40,6 @@ INT cmdLocalGroup(INT argc, WCHAR **argv);
|
|||
INT cmdPause(INT argc, WCHAR **argv);
|
||||
INT cmdStart(INT argc, WCHAR **argv);
|
||||
INT cmdStop(INT argc, WCHAR **argv);
|
||||
INT cmdUser(INT argc, WCHAR **argv);
|
||||
|
||||
#endif /* _NET_PCH_ */
|
||||
|
|
|
@ -121,6 +121,7 @@ static inline D3DVECTOR VectorBetweenTwoPoints (const D3DVECTOR *a, const D3DVEC
|
|||
return c;
|
||||
}
|
||||
|
||||
#ifndef __REACTOS__
|
||||
/* calculates the length of vector's projection on another vector */
|
||||
static inline D3DVALUE ProjectVector (const D3DVECTOR *a, const D3DVECTOR *p)
|
||||
{
|
||||
|
@ -131,6 +132,7 @@ static inline D3DVALUE ProjectVector (const D3DVECTOR *a, const D3DVECTOR *p)
|
|||
p->y, p->z, result);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************************************************
|
||||
* 3D Buffer and Listener mixing
|
||||
|
|
|
@ -17,9 +17,6 @@ add_rpc_files(client
|
|||
${REACTOS_SOURCE_DIR}/include/reactos/idl/svcctl.idl)
|
||||
|
||||
list(APPEND SOURCE
|
||||
crypt/crypt.c
|
||||
crypt/crypt_des.c
|
||||
crypt/crypt_lmhash.c
|
||||
misc/dllmain.c
|
||||
misc/efs.c
|
||||
misc/hwprofiles.c
|
||||
|
@ -44,6 +41,9 @@ list(APPEND SOURCE
|
|||
service/sctrl.c
|
||||
token/privilege.c
|
||||
token/token.c
|
||||
wine/crypt.c
|
||||
wine/crypt_des.c
|
||||
wine/crypt_lmhash.c
|
||||
advapi32.h)
|
||||
|
||||
add_library(advapi32 SHARED
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include <wine/debug.h>
|
||||
#include <wine/unicode.h>
|
||||
|
||||
#include "crypt/crypt.h"
|
||||
#include "wine/crypt.h"
|
||||
|
||||
#ifndef HAS_FN_PROGRESSW
|
||||
#define FN_PROGRESSW FN_PROGRESS
|
||||
|
|
|
@ -28,10 +28,6 @@
|
|||
#include <winnls.h>
|
||||
#include <shlwapi.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(winspool);
|
||||
|
||||
/******************************************************************************
|
||||
* GetDefaultPrinterA (WINSPOOL.@)
|
||||
*/
|
||||
|
|
|
@ -69,7 +69,7 @@ RemoveBatteryFromList(IN PCUNICODE_STRING BatteryName,
|
|||
/* Done */
|
||||
ExReleaseFastMutex(&DeviceExtension->Lock);
|
||||
if (CompBattDebug & 1) DbgPrint("CompBatt: EXITING RemoveBatteryFromList\n");
|
||||
return STATUS_SUCCESS;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
|
|
@ -118,7 +118,7 @@ PciInitIdBuffer(IN PPCI_ID_BUFFER IdBuffer)
|
|||
}
|
||||
|
||||
ULONG
|
||||
NTAPI
|
||||
__cdecl
|
||||
PciIdPrintf(IN PPCI_ID_BUFFER IdBuffer,
|
||||
IN PCCH Format,
|
||||
...)
|
||||
|
@ -153,7 +153,7 @@ PciIdPrintf(IN PPCI_ID_BUFFER IdBuffer,
|
|||
}
|
||||
|
||||
ULONG
|
||||
NTAPI
|
||||
__cdecl
|
||||
PciIdPrintfAppend(IN PPCI_ID_BUFFER IdBuffer,
|
||||
IN PCCH Format,
|
||||
...)
|
||||
|
|
|
@ -256,9 +256,11 @@ check Wine current souces first as it may already be fixed.
|
|||
reactos/lib/3rdparty/strmbase # Synced to Wine-1.7.27
|
||||
|
||||
advapi32 -
|
||||
reactos/dll/win32/advapi32/crypt/*.c # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/advapi32/sec/cred.c # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/advapi32/sec/sid.c # Out of Sync
|
||||
reactos/dll/win32/advapi32/wine/crypt.c # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/advapi32/wine/crypt_des.c # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/advapi32/wine/crypt_lmhash.c # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/advapi32/sec/cred.c # Synced to Wine-1.7.27
|
||||
reactos/dll/win32/advapi32/sec/sid.c # Out of Sync
|
||||
|
||||
gdi32 -
|
||||
reactos/dll/win32/gdi32/objects/linedda.c # Synced at 20090410
|
||||
|
|
|
@ -385,7 +385,7 @@ typedef struct _OPEN_PACKET
|
|||
typedef struct _LOAD_UNLOAD_PARAMS
|
||||
{
|
||||
NTSTATUS Status;
|
||||
PUNICODE_STRING ServiceName;
|
||||
PCUNICODE_STRING RegistryPath;
|
||||
WORK_QUEUE_ITEM WorkItem;
|
||||
KEVENT Event;
|
||||
PDRIVER_OBJECT DriverObject;
|
||||
|
@ -1083,10 +1083,11 @@ IopLoadServiceModule(
|
|||
OUT PLDR_DATA_TABLE_ENTRY *ModuleObject
|
||||
);
|
||||
|
||||
VOID
|
||||
NTSTATUS
|
||||
NTAPI
|
||||
IopLoadUnloadDriver(
|
||||
IN OUT PLOAD_UNLOAD_PARAMS LoadParams
|
||||
_In_opt_ PCUNICODE_STRING RegistryPath,
|
||||
_Inout_ PDRIVER_OBJECT *DriverObject
|
||||
);
|
||||
|
||||
NTSTATUS
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -70,7 +70,7 @@ IOReadB(USHORT Port)
|
|||
{
|
||||
UCHAR Data;
|
||||
ASSERT(Port <= MAXWORD);
|
||||
IoPortProc[Port].VddIoHandlers.inb_handler((WORD)Port, &Data);
|
||||
IoPortProc[Port].VddIoHandlers.inb_handler(Port, &Data);
|
||||
return Data;
|
||||
}
|
||||
else
|
||||
|
@ -82,7 +82,7 @@ IOReadB(USHORT Port)
|
|||
}
|
||||
|
||||
VOID
|
||||
IOReadStrB(USHORT Port,
|
||||
IOReadStrB(USHORT Port,
|
||||
PUCHAR Buffer,
|
||||
ULONG Count)
|
||||
{
|
||||
|
@ -96,7 +96,7 @@ IOReadStrB(USHORT Port,
|
|||
{
|
||||
ASSERT(Port <= MAXWORD);
|
||||
ASSERT(Count <= MAXWORD);
|
||||
IoPortProc[Port].VddIoHandlers.insb_handler((WORD)Port, Buffer, (WORD)Count);
|
||||
IoPortProc[Port].VddIoHandlers.insb_handler(Port, Buffer, (WORD)Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ IOReadStrB(USHORT Port,
|
|||
|
||||
VOID
|
||||
IOWriteB(USHORT Port,
|
||||
UCHAR Buffer)
|
||||
UCHAR Buffer)
|
||||
{
|
||||
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
|
||||
IoPortProc[Port].IoHandlers.OutB)
|
||||
|
@ -117,7 +117,7 @@ IOWriteB(USHORT Port,
|
|||
IoPortProc[Port].VddIoHandlers.outb_handler)
|
||||
{
|
||||
ASSERT(Port <= MAXWORD);
|
||||
IoPortProc[Port].VddIoHandlers.outb_handler((WORD)Port, Buffer);
|
||||
IoPortProc[Port].VddIoHandlers.outb_handler(Port, Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -127,7 +127,7 @@ IOWriteB(USHORT Port,
|
|||
}
|
||||
|
||||
VOID
|
||||
IOWriteStrB(USHORT Port,
|
||||
IOWriteStrB(USHORT Port,
|
||||
PUCHAR Buffer,
|
||||
ULONG Count)
|
||||
{
|
||||
|
@ -141,7 +141,7 @@ IOWriteStrB(USHORT Port,
|
|||
{
|
||||
ASSERT(Port <= MAXWORD);
|
||||
ASSERT(Count <= MAXWORD);
|
||||
IoPortProc[Port].VddIoHandlers.outsb_handler((WORD)Port, Buffer, (WORD)Count);
|
||||
IoPortProc[Port].VddIoHandlers.outsb_handler(Port, Buffer, (WORD)Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -162,7 +162,7 @@ IOReadW(USHORT Port)
|
|||
{
|
||||
USHORT Data;
|
||||
ASSERT(Port <= MAXWORD);
|
||||
IoPortProc[Port].VddIoHandlers.inw_handler((WORD)Port, &Data);
|
||||
IoPortProc[Port].VddIoHandlers.inw_handler(Port, &Data);
|
||||
return Data;
|
||||
}
|
||||
else
|
||||
|
@ -177,7 +177,7 @@ IOReadW(USHORT Port)
|
|||
}
|
||||
|
||||
VOID
|
||||
IOReadStrW(USHORT Port,
|
||||
IOReadStrW(USHORT Port,
|
||||
PUSHORT Buffer,
|
||||
ULONG Count)
|
||||
{
|
||||
|
@ -191,7 +191,7 @@ IOReadStrW(USHORT Port,
|
|||
{
|
||||
ASSERT(Port <= MAXWORD);
|
||||
ASSERT(Count <= MAXWORD);
|
||||
IoPortProc[Port].VddIoHandlers.insw_handler((WORD)Port, Buffer, (WORD)Count);
|
||||
IoPortProc[Port].VddIoHandlers.insw_handler(Port, Buffer, (WORD)Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -200,7 +200,7 @@ IOReadStrW(USHORT Port,
|
|||
}
|
||||
|
||||
VOID
|
||||
IOWriteW(USHORT Port,
|
||||
IOWriteW(USHORT Port,
|
||||
USHORT Buffer)
|
||||
{
|
||||
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
|
||||
|
@ -212,7 +212,7 @@ IOWriteW(USHORT Port,
|
|||
IoPortProc[Port].VddIoHandlers.outw_handler)
|
||||
{
|
||||
ASSERT(Port <= MAXWORD);
|
||||
IoPortProc[Port].VddIoHandlers.outw_handler((WORD)Port, Buffer);
|
||||
IoPortProc[Port].VddIoHandlers.outw_handler(Port, Buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -223,7 +223,7 @@ IOWriteW(USHORT Port,
|
|||
}
|
||||
|
||||
VOID
|
||||
IOWriteStrW(USHORT Port,
|
||||
IOWriteStrW(USHORT Port,
|
||||
PUSHORT Buffer,
|
||||
ULONG Count)
|
||||
{
|
||||
|
@ -237,7 +237,7 @@ IOWriteStrW(USHORT Port,
|
|||
{
|
||||
ASSERT(Port <= MAXWORD);
|
||||
ASSERT(Count <= MAXWORD);
|
||||
IoPortProc[Port].VddIoHandlers.outsw_handler((WORD)Port, Buffer, (WORD)Count);
|
||||
IoPortProc[Port].VddIoHandlers.outsw_handler(Port, Buffer, (WORD)Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -265,7 +265,7 @@ IOReadD(USHORT Port)
|
|||
}
|
||||
|
||||
VOID
|
||||
IOReadStrD(USHORT Port,
|
||||
IOReadStrD(USHORT Port,
|
||||
PULONG Buffer,
|
||||
ULONG Count)
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ IOReadStrD(USHORT Port,
|
|||
|
||||
VOID
|
||||
IOWriteD(USHORT Port,
|
||||
ULONG Buffer)
|
||||
ULONG Buffer)
|
||||
{
|
||||
if (IoPortProc[Port].hVdd == INVALID_HANDLE_VALUE &&
|
||||
IoPortProc[Port].IoHandlers.OutD)
|
||||
|
@ -298,7 +298,7 @@ IOWriteD(USHORT Port,
|
|||
}
|
||||
|
||||
VOID
|
||||
IOWriteStrD(USHORT Port,
|
||||
IOWriteStrD(USHORT Port,
|
||||
PULONG Buffer,
|
||||
ULONG Count)
|
||||
{
|
||||
|
|
|
@ -36,45 +36,45 @@ typedef VOID (WINAPI *EMULATOR_OUTSD_PROC)(USHORT Port, PULONG Buffer, ULONG Co
|
|||
UCHAR
|
||||
IOReadB(USHORT Port);
|
||||
VOID
|
||||
IOReadStrB(USHORT Port,
|
||||
IOReadStrB(USHORT Port,
|
||||
PUCHAR Buffer,
|
||||
ULONG Count);
|
||||
|
||||
VOID
|
||||
IOWriteB(USHORT Port,
|
||||
UCHAR Buffer);
|
||||
UCHAR Buffer);
|
||||
VOID
|
||||
IOWriteStrB(USHORT Port,
|
||||
IOWriteStrB(USHORT Port,
|
||||
PUCHAR Buffer,
|
||||
ULONG Count);
|
||||
|
||||
USHORT
|
||||
IOReadW(USHORT Port);
|
||||
VOID
|
||||
IOReadStrW(USHORT Port,
|
||||
IOReadStrW(USHORT Port,
|
||||
PUSHORT Buffer,
|
||||
ULONG Count);
|
||||
|
||||
VOID
|
||||
IOWriteW(USHORT Port,
|
||||
IOWriteW(USHORT Port,
|
||||
USHORT Buffer);
|
||||
VOID
|
||||
IOWriteStrW(USHORT Port,
|
||||
IOWriteStrW(USHORT Port,
|
||||
PUSHORT Buffer,
|
||||
ULONG Count);
|
||||
|
||||
ULONG
|
||||
IOReadD(USHORT Port);
|
||||
VOID
|
||||
IOReadStrD(USHORT Port,
|
||||
IOReadStrD(USHORT Port,
|
||||
PULONG Buffer,
|
||||
ULONG Count);
|
||||
|
||||
VOID
|
||||
IOWriteD(USHORT Port,
|
||||
ULONG Buffer);
|
||||
ULONG Buffer);
|
||||
VOID
|
||||
IOWriteStrD(USHORT Port,
|
||||
IOWriteStrD(USHORT Port,
|
||||
PULONG Buffer,
|
||||
ULONG Count);
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <win32k.h>
|
||||
DBG_DEFAULT_CHANNEL(UserClass);
|
||||
|
||||
BOOL FASTCALL IntClassDestroyIcon(HANDLE hCurIcon);
|
||||
static NTSTATUS IntDeregisterClassAtom(IN RTL_ATOM Atom);
|
||||
|
||||
REGISTER_SYSCLASS DefaultServerClasses[] =
|
||||
|
@ -251,7 +250,13 @@ IntDestroyClass(IN OUT PCLS Class)
|
|||
if (Class->spcur)
|
||||
UserDereferenceObject(Class->spcur);
|
||||
if (Class->spicnSm)
|
||||
{
|
||||
UserDereferenceObject(Class->spicnSm);
|
||||
/* Destroy the icon if we own it */
|
||||
if ((Class->CSF_flags & CSF_CACHEDSMICON)
|
||||
&& !(UserObjectInDestroy(UserHMGetHandle(Class->spicnSm))))
|
||||
IntDestroyCurIconObject(Class->spicnSm);
|
||||
}
|
||||
#else
|
||||
if (Class->hIconSmIntern)
|
||||
IntClassDestroyIcon(Class->hIconSmIntern);
|
||||
|
@ -1969,6 +1974,7 @@ UserSetClassLongPtr(IN PCLS Class,
|
|||
{
|
||||
/* We will change the small icon */
|
||||
UserDereferenceObject(Class->spicnSm);
|
||||
IntDestroyCurIconObject(Class->spicnSm);
|
||||
Class->spicnSm = NULL;
|
||||
Class->CSF_flags &= ~CSF_CACHEDSMICON;
|
||||
}
|
||||
|
@ -1985,7 +1991,7 @@ UserSetClassLongPtr(IN PCLS Class,
|
|||
IMAGE_ICON,
|
||||
UserGetSystemMetrics( SM_CXSMICON ),
|
||||
UserGetSystemMetrics( SM_CYSMICON ),
|
||||
LR_COPYFROMRESOURCE | LR_SHARED);
|
||||
LR_COPYFROMRESOURCE);
|
||||
}
|
||||
if (!SmallIconHandle)
|
||||
{
|
||||
|
@ -1995,7 +2001,7 @@ UserSetClassLongPtr(IN PCLS Class,
|
|||
IMAGE_ICON,
|
||||
UserGetSystemMetrics( SM_CXSMICON ),
|
||||
UserGetSystemMetrics( SM_CYSMICON ),
|
||||
LR_SHARED);
|
||||
0);
|
||||
}
|
||||
if (SmallIconHandle)
|
||||
{
|
||||
|
@ -2062,6 +2068,7 @@ UserSetClassLongPtr(IN PCLS Class,
|
|||
#ifdef NEW_CURSORICON
|
||||
{
|
||||
PCURICON_OBJECT NewSmallIcon = NULL;
|
||||
BOOLEAN NewIconFromCache = FALSE;
|
||||
|
||||
if (NewLong)
|
||||
{
|
||||
|
@ -2072,10 +2079,54 @@ UserSetClassLongPtr(IN PCLS Class,
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Create the new small icon from the large one */
|
||||
HICON SmallIconHandle = NULL;
|
||||
if((Class->spicn->CURSORF_flags & (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
|
||||
== (CURSORF_LRSHARED | CURSORF_FROMRESOURCE))
|
||||
{
|
||||
SmallIconHandle = co_IntCopyImage(
|
||||
UserHMGetHandle(Class->spicn),
|
||||
IMAGE_ICON,
|
||||
UserGetSystemMetrics( SM_CXSMICON ),
|
||||
UserGetSystemMetrics( SM_CYSMICON ),
|
||||
LR_COPYFROMRESOURCE);
|
||||
}
|
||||
if (!SmallIconHandle)
|
||||
{
|
||||
/* Retry without copying from resource */
|
||||
SmallIconHandle = co_IntCopyImage(
|
||||
UserHMGetHandle(Class->spicn),
|
||||
IMAGE_ICON,
|
||||
UserGetSystemMetrics( SM_CXSMICON ),
|
||||
UserGetSystemMetrics( SM_CYSMICON ),
|
||||
0);
|
||||
}
|
||||
if (SmallIconHandle)
|
||||
{
|
||||
/* So use it */
|
||||
NewSmallIcon = UserGetCurIconObject(SmallIconHandle);
|
||||
NewIconFromCache = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ERR("Failed getting a small icon for the class.\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (Class->spicnSm)
|
||||
{
|
||||
Ret = (ULONG_PTR)UserHMGetHandle(Class->spicnSm);
|
||||
if (Class->CSF_flags & CSF_CACHEDSMICON)
|
||||
{
|
||||
/* We must destroy the icon if we own it */
|
||||
IntDestroyCurIconObject(Class->spicnSm);
|
||||
Ret = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Ret = (ULONG_PTR)UserHMGetHandle(Class->spicnSm);
|
||||
}
|
||||
UserDereferenceObject(Class->spicnSm);
|
||||
}
|
||||
else
|
||||
|
@ -2083,7 +2134,10 @@ UserSetClassLongPtr(IN PCLS Class,
|
|||
Ret = 0;
|
||||
}
|
||||
|
||||
Class->CSF_flags &= ~CSF_CACHEDSMICON;
|
||||
if (NewIconFromCache)
|
||||
Class->CSF_flags |= CSF_CACHEDSMICON;
|
||||
else
|
||||
Class->CSF_flags &= ~CSF_CACHEDSMICON;
|
||||
Class->spicnSm = NewSmallIcon;
|
||||
|
||||
/* Update the clones */
|
||||
|
@ -2094,7 +2148,10 @@ UserSetClassLongPtr(IN PCLS Class,
|
|||
UserDereferenceObject(Class->spicnSm);
|
||||
if (NewSmallIcon)
|
||||
UserReferenceObject(NewSmallIcon);
|
||||
Class->CSF_flags &= ~CSF_CACHEDSMICON;
|
||||
if (NewIconFromCache)
|
||||
Class->CSF_flags |= CSF_CACHEDSMICON;
|
||||
else
|
||||
Class->CSF_flags &= ~CSF_CACHEDSMICON;
|
||||
Class->spicnSm = NewSmallIcon;
|
||||
Class = Class->pclsNext;
|
||||
}
|
||||
|
|
|
@ -187,7 +187,8 @@ IntDestroyCurIconObject(
|
|||
|
||||
/* We just mark the handle as being destroyed.
|
||||
* Deleting all the stuff will be deferred to the actual struct free. */
|
||||
return UserDeleteObject(CurIcon->head.h, TYPE_CURSOR);
|
||||
UserDeleteObject(CurIcon->head.h, TYPE_CURSOR);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -357,16 +358,18 @@ NtUserGetIconInfo(
|
|||
/* Get the module name from the atom table */
|
||||
_SEH2_TRY
|
||||
{
|
||||
if (BufLen > (lpModule->MaximumLength * sizeof(WCHAR)))
|
||||
BufLen += sizeof(WCHAR);
|
||||
if (BufLen > (lpModule->MaximumLength))
|
||||
{
|
||||
lpModule->Length = 0;
|
||||
lpModule->MaximumLength = BufLen;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProbeForWrite(lpModule->Buffer, lpModule->MaximumLength, 1);
|
||||
BufLen = lpModule->MaximumLength * sizeof(WCHAR);
|
||||
BufLen = lpModule->MaximumLength;
|
||||
RtlQueryAtomInAtomTable(gAtomTable, CurIcon->atomModName, NULL, NULL, lpModule->Buffer, &BufLen);
|
||||
lpModule->Length = BufLen/sizeof(WCHAR);
|
||||
lpModule->Length = BufLen;
|
||||
}
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
|
@ -395,15 +398,18 @@ NtUserGetIconInfo(
|
|||
{
|
||||
lpResName->Buffer = CurIcon->strName.Buffer;
|
||||
lpResName->Length = 0;
|
||||
lpResName->MaximumLength = 0;
|
||||
}
|
||||
else if (lpResName->MaximumLength < CurIcon->strName.Length)
|
||||
else if (lpResName->MaximumLength < CurIcon->strName.MaximumLength)
|
||||
{
|
||||
lpResName->Length = 0;
|
||||
lpResName->MaximumLength = CurIcon->strName.MaximumLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProbeForWrite(lpResName->Buffer, lpResName->MaximumLength * sizeof(WCHAR), 1);
|
||||
RtlCopyMemory(lpResName->Buffer, CurIcon->strName.Buffer, lpResName->Length);
|
||||
ProbeForWrite(lpResName->Buffer, lpResName->MaximumLength, 1);
|
||||
RtlCopyMemory(lpResName->Buffer, CurIcon->strName.Buffer, CurIcon->strName.Length);
|
||||
lpResName->Length = CurIcon->strName.Length;
|
||||
}
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
|
|
|
@ -1686,7 +1686,7 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
|
|||
IMAGE_ICON,
|
||||
UserGetSystemMetrics( SM_CXSMICON ),
|
||||
UserGetSystemMetrics( SM_CYSMICON ),
|
||||
LR_COPYFROMRESOURCE | LR_SHARED);
|
||||
LR_COPYFROMRESOURCE);
|
||||
}
|
||||
if (!IconSmHandle)
|
||||
{
|
||||
|
@ -1696,7 +1696,7 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
|
|||
IMAGE_ICON,
|
||||
UserGetSystemMetrics( SM_CXSMICON ),
|
||||
UserGetSystemMetrics( SM_CYSMICON ),
|
||||
LR_SHARED);
|
||||
0);
|
||||
}
|
||||
|
||||
if (IconSmHandle)
|
||||
|
|
|
@ -397,7 +397,7 @@ get_best_icon_file_entry(
|
|||
if ( dwFileSize < sizeof(*dir) )
|
||||
return NULL;
|
||||
|
||||
if (dwFileSize < (sizeof(*dir) + FIELD_OFFSET(CURSORICONFILEDIR, idEntries[dir->idCount])))
|
||||
if (dwFileSize < FIELD_OFFSET(CURSORICONFILEDIR, idEntries[dir->idCount]))
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
|
@ -1342,27 +1342,37 @@ CURSORICON_LoadImageW(
|
|||
}
|
||||
else
|
||||
RtlInitUnicodeString(&ustrRsrc, lpszName);
|
||||
|
||||
/* Prepare the module name string */
|
||||
ustrModule.Buffer = HeapAlloc(GetProcessHeap(), 0, size*sizeof(WCHAR));
|
||||
/* Get it */
|
||||
do
|
||||
|
||||
/* Get the module name string */
|
||||
while (TRUE)
|
||||
{
|
||||
DWORD ret = GetModuleFileNameW(hinst, ustrModule.Buffer, size);
|
||||
DWORD ret;
|
||||
ustrModule.Buffer = HeapAlloc(GetProcessHeap(), 0, size*sizeof(WCHAR));
|
||||
if (!ustrModule.Buffer)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
ret = GetModuleFileNameW(hinst, ustrModule.Buffer, size);
|
||||
if(ret == 0)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, ustrModule.Buffer);
|
||||
return NULL;
|
||||
}
|
||||
if(ret < size)
|
||||
|
||||
/* This API is completely broken... */
|
||||
if (ret == size)
|
||||
{
|
||||
ustrModule.Length = ret*sizeof(WCHAR);
|
||||
ustrModule.MaximumLength = size*sizeof(WCHAR);
|
||||
break;
|
||||
HeapFree(GetProcessHeap(), 0, ustrModule.Buffer);
|
||||
size *= 2;
|
||||
continue;
|
||||
}
|
||||
size *= 2;
|
||||
ustrModule.Buffer = HeapReAlloc(GetProcessHeap(), 0, ustrModule.Buffer, size*sizeof(WCHAR));
|
||||
} while(TRUE);
|
||||
|
||||
ustrModule.Buffer[ret] = UNICODE_NULL;
|
||||
ustrModule.Length = ret * sizeof(WCHAR);
|
||||
ustrModule.MaximumLength = size * sizeof(WCHAR);
|
||||
break;
|
||||
}
|
||||
|
||||
/* Ask win32k */
|
||||
param.bIcon = bIcon;
|
||||
|
@ -1691,75 +1701,51 @@ CURSORICON_CopyImage(
|
|||
/* Get the icon module/resource names */
|
||||
UNICODE_STRING ustrModule;
|
||||
UNICODE_STRING ustrRsrc;
|
||||
PVOID pvBuf;
|
||||
HMODULE hModule;
|
||||
|
||||
ustrModule.MaximumLength = MAX_PATH * sizeof(WCHAR);
|
||||
ustrRsrc.MaximumLength = 256;
|
||||
ustrModule.MaximumLength = 0;
|
||||
ustrRsrc.MaximumLength = 0;
|
||||
|
||||
/* Get the buffer size */
|
||||
if (!NtUserGetIconInfo(hicon, NULL, &ustrModule, &ustrRsrc, NULL, FALSE))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ustrModule.Buffer = HeapAlloc(GetProcessHeap(), 0, ustrModule.MaximumLength);
|
||||
if (!ustrModule.Buffer)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
/* Keep track of the buffer for the resource, NtUserGetIconInfo might overwrite it */
|
||||
pvBuf = HeapAlloc(GetProcessHeap(), 0, ustrRsrc.MaximumLength);
|
||||
if (!pvBuf)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, ustrModule.Buffer);
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
ustrRsrc.Buffer = pvBuf;
|
||||
|
||||
do
|
||||
if (ustrRsrc.MaximumLength)
|
||||
{
|
||||
if (!NtUserGetIconInfo(hicon, NULL, &ustrModule, &ustrRsrc, NULL, FALSE))
|
||||
ustrRsrc.Buffer = HeapAlloc(GetProcessHeap(), 0, ustrRsrc.MaximumLength);
|
||||
if (!ustrRsrc.Buffer)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, ustrModule.Buffer);
|
||||
HeapFree(GetProcessHeap(), 0, pvBuf);
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ustrModule.Length && (ustrRsrc.Length || IS_INTRESOURCE(ustrRsrc.Buffer)))
|
||||
{
|
||||
/* Buffers were big enough */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Find which buffer were too small */
|
||||
if (!ustrModule.Length)
|
||||
{
|
||||
PWSTR newBuffer;
|
||||
ustrModule.MaximumLength *= 2;
|
||||
newBuffer = HeapReAlloc(GetProcessHeap(), 0, ustrModule.Buffer, ustrModule.MaximumLength);
|
||||
if(!ustrModule.Buffer)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
goto leave;
|
||||
}
|
||||
ustrModule.Buffer = newBuffer;
|
||||
}
|
||||
|
||||
if (!ustrRsrc.Length)
|
||||
{
|
||||
ustrRsrc.MaximumLength *= 2;
|
||||
pvBuf = HeapReAlloc(GetProcessHeap(), 0, ustrRsrc.Buffer, ustrRsrc.MaximumLength);
|
||||
if (!pvBuf)
|
||||
{
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
goto leave;
|
||||
}
|
||||
ustrRsrc.Buffer = pvBuf;
|
||||
}
|
||||
} while(TRUE);
|
||||
}
|
||||
|
||||
if (!NtUserGetIconInfo(hicon, NULL, &ustrModule, &ustrRsrc, NULL, FALSE))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, ustrModule.Buffer);
|
||||
if (!IS_INTRESOURCE(ustrRsrc.Buffer))
|
||||
HeapFree(GetProcessHeap(), 0, ustrRsrc.Buffer);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* NULL-terminate our strings */
|
||||
ustrModule.Buffer[ustrModule.Length/sizeof(WCHAR)] = 0;
|
||||
ustrModule.Buffer[ustrModule.Length/sizeof(WCHAR)] = UNICODE_NULL;
|
||||
if (!IS_INTRESOURCE(ustrRsrc.Buffer))
|
||||
ustrRsrc.Buffer[ustrRsrc.Length/sizeof(WCHAR)] = 0;
|
||||
ustrRsrc.Buffer[ustrRsrc.Length/sizeof(WCHAR)] = UNICODE_NULL;
|
||||
|
||||
TRACE("Got module %S, resource %p (%S).\n", ustrModule.Buffer,
|
||||
ustrRsrc.Buffer, IS_INTRESOURCE(ustrRsrc.Buffer) ? L"" : ustrRsrc.Buffer);
|
||||
|
||||
/* Get the module handle */
|
||||
if (!GetModuleHandleExW(0, ustrModule.Buffer, &hModule))
|
||||
{
|
||||
|
@ -1783,7 +1769,8 @@ CURSORICON_CopyImage(
|
|||
/* If we're here, that means that the passed icon is shared. Don't destroy it, even if LR_COPYDELETEORG is specified */
|
||||
leave:
|
||||
HeapFree(GetProcessHeap(), 0, ustrModule.Buffer);
|
||||
HeapFree(GetProcessHeap(), 0, pvBuf);
|
||||
if (!IS_INTRESOURCE(ustrRsrc.Buffer))
|
||||
HeapFree(GetProcessHeap(), 0, ustrRsrc.Buffer);
|
||||
|
||||
TRACE("Returning 0x%08x.\n", ret);
|
||||
|
||||
|
|
Loading…
Reference in a new issue