mirror of
https://github.com/reactos/reactos.git
synced 2024-07-30 08:08:56 +00:00
Merge 15329:15546 from trunk
svn path=/branches/xmlbuildsystem/; revision=15547
This commit is contained in:
commit
062423314c
|
@ -1,4 +1,4 @@
|
|||
/* $Id$
|
||||
/*
|
||||
*
|
||||
* ReactOS ps - process list console viewer
|
||||
*
|
||||
|
@ -26,6 +26,67 @@
|
|||
/* NOTE: W32API ddk/ntapi.h header has wrong definition of SYSTEM_PROCESSES. */
|
||||
#include <ntos/types.h>
|
||||
|
||||
typedef struct _SYSTEM_THREADS
|
||||
{
|
||||
LARGE_INTEGER KernelTime;
|
||||
LARGE_INTEGER UserTime;
|
||||
LARGE_INTEGER CreateTime;
|
||||
ULONG WaitTime;
|
||||
PVOID StartAddress;
|
||||
CLIENT_ID ClientId;
|
||||
KPRIORITY Priority;
|
||||
LONG BasePriority;
|
||||
ULONG ContextSwitches;
|
||||
ULONG ThreadState;
|
||||
ULONG WaitReason;
|
||||
} SYSTEM_THREADS, *PSYSTEM_THREADS;
|
||||
|
||||
typedef struct _SYSTEM_PROCESSES
|
||||
{
|
||||
ULONG NextEntryOffset;
|
||||
ULONG NumberOfThreads;
|
||||
LARGE_INTEGER SpareLi1;
|
||||
LARGE_INTEGER SpareLi2;
|
||||
LARGE_INTEGER SpareLi3;
|
||||
LARGE_INTEGER CreateTime;
|
||||
LARGE_INTEGER UserTime;
|
||||
LARGE_INTEGER KernelTime;
|
||||
UNICODE_STRING ImageName;
|
||||
KPRIORITY BasePriority;
|
||||
HANDLE UniqueProcessId;
|
||||
HANDLE InheritedFromUniqueProcessId;
|
||||
ULONG HandleCount;
|
||||
ULONG SessionId;
|
||||
ULONG PageDirectoryFrame;
|
||||
|
||||
/*
|
||||
* This part corresponds to VM_COUNTERS_EX.
|
||||
* NOTE: *NOT* THE SAME AS VM_COUNTERS!
|
||||
*/
|
||||
ULONG PeakVirtualSize;
|
||||
ULONG VirtualSize;
|
||||
ULONG PageFaultCount;
|
||||
ULONG PeakWorkingSetSize;
|
||||
ULONG WorkingSetSize;
|
||||
ULONG QuotaPeakPagedPoolUsage;
|
||||
ULONG QuotaPagedPoolUsage;
|
||||
ULONG QuotaPeakNonPagedPoolUsage;
|
||||
ULONG QuotaNonPagedPoolUsage;
|
||||
ULONG PagefileUsage;
|
||||
ULONG PeakPagefileUsage;
|
||||
ULONG PrivateUsage;
|
||||
|
||||
/* This part corresponds to IO_COUNTERS */
|
||||
LARGE_INTEGER ReadOperationCount;
|
||||
LARGE_INTEGER WriteOperationCount;
|
||||
LARGE_INTEGER OtherOperationCount;
|
||||
LARGE_INTEGER ReadTransferCount;
|
||||
LARGE_INTEGER WriteTransferCount;
|
||||
LARGE_INTEGER OtherTransferCount;
|
||||
|
||||
SYSTEM_THREADS Threads [1];
|
||||
} SYSTEM_PROCESSES, *PSYSTEM_PROCESSES;
|
||||
|
||||
|
||||
// x00000000 00000000 000:00:00 000:00:00 ()
|
||||
static char* title = "P PID PPID KTime UTime NAME\n";
|
||||
|
@ -50,39 +111,45 @@ struct status {
|
|||
|
||||
struct waitres {
|
||||
DWORD state;
|
||||
char desc[11];
|
||||
} waitreason[28 + 1] = {
|
||||
char desc[17];
|
||||
} waitreason[35 + 1] = {
|
||||
{0, "Executive "},
|
||||
{1, "FreePage "},
|
||||
{2, "PageIn "},
|
||||
{3, "PoolAlloc "},
|
||||
{4, "DelayExec "},
|
||||
{3, "PoolAllocation "},
|
||||
{4, "DelayExecution "},
|
||||
{5, "Suspended "},
|
||||
{6, "UserReq "},
|
||||
{7, "WrExecutive"},
|
||||
{6, "UserRequest "},
|
||||
{7, "WrExecutive "},
|
||||
{8, "WrFreePage "},
|
||||
{9, "WrPageIn "},
|
||||
{10,"WrPoolAlloc"},
|
||||
{11,"WrDelayExec"},
|
||||
{12,"WrSuspended"},
|
||||
{13,"WrUserReq "},
|
||||
{14,"WrEventPair"},
|
||||
{10,"WrPoolAllocation "},
|
||||
{11,"WrDelayExecution "},
|
||||
{12,"WrSuspended "},
|
||||
{13,"WrUserRequest "},
|
||||
{14,"WrEventPair "},
|
||||
{15,"WrQueue "},
|
||||
{16,"WrLpcRec "},
|
||||
{16,"WrLpcReceive "},
|
||||
{17,"WrLpcReply "},
|
||||
{18,"WrVirtualMm"},
|
||||
{18,"WrVirtualMemory "},
|
||||
{19,"WrPageOut "},
|
||||
{20,"WrRendez "},
|
||||
{21,"Spare1 "},
|
||||
{22,"Spare2 "},
|
||||
{23,"Spare3 "},
|
||||
{24,"Spare4 "},
|
||||
{25,"Spare5 "},
|
||||
{26,"Spare6 "},
|
||||
{27,"WrKernel "},
|
||||
{20,"WrRendezvous "},
|
||||
{21,"Spare2 "},
|
||||
{22,"WrGuardedMutex "},
|
||||
{23,"Spare4 "},
|
||||
{24,"Spare5 "},
|
||||
{25,"Spare6 "},
|
||||
{26,"WrKernel "},
|
||||
{27,"WrResource "},
|
||||
{28,"WrPushLock "},
|
||||
{29,"WrMutex "},
|
||||
{30,"WrQuantumEnd "},
|
||||
{31,"WrDispatchInt "},
|
||||
{32,"WrPreempted "},
|
||||
{33,"WrYieldExecution "},
|
||||
{34,"MaximumWaitReason"},
|
||||
{-1," ? "}
|
||||
};
|
||||
|
||||
BOOL CALLBACK
|
||||
EnumThreadProc(HWND hwnd, LPARAM lp)
|
||||
{
|
||||
|
@ -110,8 +177,8 @@ int main()
|
|||
DWORD r;
|
||||
ANSI_STRING astring;
|
||||
HANDLE stdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
PSYSTEM_PROCESS_INFORMATION SystemProcesses = NULL;
|
||||
PSYSTEM_PROCESS_INFORMATION CurrentProcess;
|
||||
PSYSTEM_PROCESSES SystemProcesses = NULL;
|
||||
PSYSTEM_PROCESSES CurrentProcess;
|
||||
ULONG BufferSize, ReturnSize;
|
||||
NTSTATUS Status;
|
||||
char buf[256];
|
||||
|
@ -175,36 +242,36 @@ int main()
|
|||
struct waitres *waitt;
|
||||
char szWindowName[30] = {" "};
|
||||
|
||||
ptime = CurrentProcess->TH[ti].KernelTime;
|
||||
ptime = CurrentProcess->Threads[ti].KernelTime;
|
||||
thour = (ptime.QuadPart / (10000000LL * 3600LL));
|
||||
tmin = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
|
||||
tsec = (ptime.QuadPart / 10000000LL) % 60LL;
|
||||
|
||||
ptime = CurrentProcess->TH[ti].UserTime;
|
||||
ptime = CurrentProcess->Threads[ti].UserTime;
|
||||
thour1 = (ptime.QuadPart / (10000000LL * 3600LL));
|
||||
tmin1 = (ptime.QuadPart / (10000000LL * 60LL)) % 60LL;
|
||||
tsec1 = (ptime.QuadPart / 10000000LL) % 60LL;
|
||||
|
||||
statt = thread_stat;
|
||||
while (statt->state != CurrentProcess->TH[ti].ThreadState && statt->state >= 0)
|
||||
while (statt->state != CurrentProcess->Threads[ti].ThreadState && statt->state >= 0)
|
||||
statt++;
|
||||
|
||||
waitt = waitreason;
|
||||
while (waitt->state != CurrentProcess->TH[ti].WaitReason && waitt->state >= 0)
|
||||
while (waitt->state != CurrentProcess->Threads[ti].WaitReason && waitt->state >= 0)
|
||||
waitt++;
|
||||
|
||||
wsprintf (buf1,
|
||||
"t% %8d %3d:%02d:%02d %3d:%02d:%02d %s %s\n",
|
||||
CurrentProcess->TH[ti].ClientId.UniqueThread,
|
||||
CurrentProcess->Threads[ti].ClientId.UniqueThread,
|
||||
thour, tmin, tsec, thour1, tmin1, tsec1,
|
||||
statt->desc , waitt->desc);
|
||||
WriteFile(stdout, buf1, lstrlen(buf1), &r, NULL);
|
||||
|
||||
EnumThreadWindows((DWORD)CurrentProcess->TH[ti].ClientId.UniqueThread,
|
||||
EnumThreadWindows((DWORD)CurrentProcess->Threads[ti].ClientId.UniqueThread,
|
||||
(ENUMWINDOWSPROC) EnumThreadProc,
|
||||
(LPARAM)(LPTSTR) szWindowName );
|
||||
}
|
||||
CurrentProcess = (PSYSTEM_PROCESS_INFORMATION)((ULONG_PTR)CurrentProcess +
|
||||
CurrentProcess = (PSYSTEM_PROCESSES)((ULONG_PTR)CurrentProcess +
|
||||
CurrentProcess->NextEntryOffset);
|
||||
}
|
||||
return (0);
|
||||
|
|
|
@ -1715,7 +1715,7 @@ DetectKeyboardPeripheral(FRLDRHKEY ControllerKey)
|
|||
/* Set 'Identifier' value */
|
||||
strcpy(Buffer,
|
||||
"PCAT_ENHANCED");
|
||||
Error = RegSetValue(ControllerKey,
|
||||
Error = RegSetValue(PeripheralKey,
|
||||
"Identifier",
|
||||
REG_SZ,
|
||||
Buffer,
|
||||
|
|
|
@ -205,9 +205,27 @@ BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLON
|
|||
{
|
||||
// Partition requested was zero which means the boot partition
|
||||
if (! DiskGetActivePartitionEntry(i386BootDrive, &PartitionTableEntry))
|
||||
{
|
||||
/* Try partition-less disk */
|
||||
*StartSector = 0;
|
||||
*SectorCount = 0;
|
||||
}
|
||||
/* Check for valid partition */
|
||||
else if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
|
||||
*SectorCount = PartitionTableEntry.PartitionSectorCount;
|
||||
}
|
||||
}
|
||||
else if (0xff == i386BootPartition)
|
||||
{
|
||||
/* Partition-less disk */
|
||||
*StartSector = 0;
|
||||
*SectorCount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -216,25 +234,26 @@ BOOL i386DiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLON
|
|||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for valid partition
|
||||
if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
|
||||
/* Check for valid partition */
|
||||
else if (PartitionTableEntry.SystemIndicator == PARTITION_ENTRY_UNUSED)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
|
||||
*SectorCount = PartitionTableEntry.PartitionSectorCount;
|
||||
}
|
||||
}
|
||||
|
||||
// Try to recognize the file system
|
||||
if (!FsRecognizeVolume(i386BootDrive, PartitionTableEntry.SectorCountBeforePartition, &VolumeType))
|
||||
if (!FsRecognizeVolume(i386BootDrive, *StartSector, &VolumeType))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*DriveNumber = i386BootDrive;
|
||||
*StartSector = PartitionTableEntry.SectorCountBeforePartition;
|
||||
*SectorCount = PartitionTableEntry.PartitionSectorCount;
|
||||
|
||||
//switch (PartitionTableEntry.SystemIndicator)
|
||||
switch (VolumeType)
|
||||
{
|
||||
case PARTITION_FAT_12:
|
||||
|
|
|
@ -63,12 +63,12 @@ BOOL DiskGetActivePartitionEntry(ULONG DriveNumber, PPARTITION_TABLE_ENTRY Parti
|
|||
// Make sure there was only one bootable partition
|
||||
if (BootablePartitionCount == 0)
|
||||
{
|
||||
DiskError("No bootable (active) partitions found.", 0);
|
||||
DbgPrint((DPRINT_DISK, "No bootable (active) partitions found.\n"));
|
||||
return FALSE;
|
||||
}
|
||||
else if (BootablePartitionCount != 1)
|
||||
{
|
||||
DiskError("Too many bootable (active) partitions found.", 0);
|
||||
DbgPrint((DPRINT_DISK, "Too many bootable (active) partitions found.\n"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ VOID BootMain(char *CmdLine)
|
|||
|
||||
DebugInit();
|
||||
|
||||
DbgPrint((DPRINT_WARNING, "BootMain() called. BootDrive = 0x%x BootPartition = %d\n", BootDrive, BootPartition));
|
||||
DbgPrint((DPRINT_WARNING, "BootMain() called.\n"));
|
||||
|
||||
if (!MmInitializeMemoryManager())
|
||||
{
|
||||
|
|
|
@ -36,6 +36,26 @@ VOID DecrementAllocationCount(VOID);
|
|||
VOID MemAllocTest(VOID);
|
||||
#endif // DEBUG
|
||||
|
||||
/*
|
||||
* Hack alert
|
||||
* Normally, we allocate whole pages. This is ofcourse wastefull for small
|
||||
* allocations (a few bytes). So, for small allocations (smaller than a page)
|
||||
* we sub-allocate. When the first small allocation is done, a page is
|
||||
* requested. We keep a pointer to that page in SubAllocationPage. The alloc
|
||||
* is satisfied by returning a pointer to the beginning of the page. We also
|
||||
* keep track of how many bytes are still available in the page in SubAllocationRest.
|
||||
* When the next small request comes in, we try to allocate it just after the
|
||||
* memory previously allocated. If it won't fit, we allocate a new page and
|
||||
* the whole process starts again.
|
||||
* Note that suballocations are done back-to-back, there's no bookkeeping at all.
|
||||
* That also means that we cannot really free suballocations. So, when a free is
|
||||
* done and it is determined that this might be a free of a sub-allocation, we
|
||||
* just no-op the free.
|
||||
* Perhaps we should use the heap routines from ntdll here.
|
||||
*/
|
||||
static PVOID SubAllocationPage = NULL;
|
||||
static unsigned SubAllocationRest = 0;
|
||||
|
||||
PVOID MmAllocateMemory(ULONG MemorySize)
|
||||
{
|
||||
ULONG PagesNeeded;
|
||||
|
@ -49,6 +69,14 @@ PVOID MmAllocateMemory(ULONG MemorySize)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
MemorySize = ROUND_UP(MemorySize, 4);
|
||||
if (MemorySize <= SubAllocationRest)
|
||||
{
|
||||
MemPointer = SubAllocationPage + MM_PAGE_SIZE - SubAllocationRest;
|
||||
SubAllocationRest -= MemorySize;
|
||||
return MemPointer;
|
||||
}
|
||||
|
||||
// Find out how many blocks it will take to
|
||||
// satisfy this allocation
|
||||
PagesNeeded = ROUND_UP(MemorySize, MM_PAGE_SIZE) / MM_PAGE_SIZE;
|
||||
|
@ -76,6 +104,13 @@ PVOID MmAllocateMemory(ULONG MemorySize)
|
|||
FreePagesInLookupTable -= PagesNeeded;
|
||||
MemPointer = (PVOID)(FirstFreePageFromEnd * MM_PAGE_SIZE);
|
||||
|
||||
if (MemorySize < MM_PAGE_SIZE)
|
||||
{
|
||||
SubAllocationPage = MemPointer;
|
||||
SubAllocationRest = MM_PAGE_SIZE - MemorySize;
|
||||
}
|
||||
|
||||
|
||||
#ifdef DEBUG
|
||||
IncrementAllocationCount();
|
||||
DbgPrint((DPRINT_MEMORY, "Allocated %d bytes (%d pages) of memory starting at page %d. AllocCount: %d\n", MemorySize, PagesNeeded, FirstFreePageFromEnd, AllocationCount));
|
||||
|
@ -235,6 +270,13 @@ VOID MmFreeMemory(PVOID MemoryPointer)
|
|||
|
||||
#endif
|
||||
|
||||
/* If this allocation is only a single page, it could be a sub-allocated page.
|
||||
* Just don't free it */
|
||||
if (1 == PageCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Loop through our array and mark all the
|
||||
// blocks as free
|
||||
for (Idx=PageNumber; Idx<(PageNumber + PageCount); Idx++)
|
||||
|
|
|
@ -756,6 +756,16 @@ LoadAndBootReactOS(PCHAR OperatingSystemName)
|
|||
if (!FrLdrLoadDriver(szHalName, 10))
|
||||
return;
|
||||
|
||||
#if 0
|
||||
/* Load bootvid */
|
||||
strcpy(value, "INBV.DLL");
|
||||
strcpy(szHalName, szBootPath);
|
||||
strcat(szHalName, "SYSTEM32\\");
|
||||
strcat(szHalName, value);
|
||||
|
||||
if (!FrLdrLoadDriver(szHalName, 10))
|
||||
return;
|
||||
#endif
|
||||
/*
|
||||
* Load the System hive from disk
|
||||
*/
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
#include "registry.h"
|
||||
|
||||
|
||||
//#define USE_UI
|
||||
#define USE_UI
|
||||
|
||||
|
||||
static BOOL
|
||||
|
@ -88,7 +88,7 @@ LoadKernel(PCHAR szSourcePath, PCHAR szFileName)
|
|||
* Update the status bar with the current file
|
||||
*/
|
||||
#ifdef USE_UI
|
||||
sprintf(szBuffer, "Reading %s", szShortName);
|
||||
sprintf(szBuffer, "Setup is loading files (%s)", szShortName);
|
||||
UiDrawStatusText(szBuffer);
|
||||
#else
|
||||
printf("Reading %s\n", szShortName);
|
||||
|
@ -155,7 +155,7 @@ LoadDriver(PCHAR szSourcePath, PCHAR szFileName)
|
|||
* Update the status bar with the current file
|
||||
*/
|
||||
#ifdef USE_UI
|
||||
sprintf(szBuffer, "Reading %s", szShortName);
|
||||
sprintf(szBuffer, "Setup is loading files (%s)", szShortName);
|
||||
UiDrawStatusText(szBuffer);
|
||||
#else
|
||||
printf("Reading %s\n", szShortName);
|
||||
|
@ -220,7 +220,7 @@ LoadNlsFile(PCHAR szSourcePath, PCHAR szFileName, PCHAR szModuleName)
|
|||
* Update the status bar with the current file
|
||||
*/
|
||||
#ifdef USE_UI
|
||||
sprintf(szBuffer, "Reading %s", szShortName);
|
||||
sprintf(szBuffer, "Setup is loading files (%s)", szShortName);
|
||||
UiDrawStatusText(szBuffer);
|
||||
#else
|
||||
printf("Reading %s\n", szShortName);
|
||||
|
@ -232,6 +232,7 @@ LoadNlsFile(PCHAR szSourcePath, PCHAR szFileName, PCHAR szModuleName)
|
|||
return(TRUE);
|
||||
}
|
||||
|
||||
BOOL SetupUiInitialize(VOID);
|
||||
|
||||
VOID RunLoader(VOID)
|
||||
{
|
||||
|
@ -294,7 +295,7 @@ VOID RunLoader(VOID)
|
|||
#endif
|
||||
|
||||
#ifdef USE_UI
|
||||
UiInitialize();
|
||||
SetupUiInitialize();
|
||||
UiDrawStatusText("");
|
||||
#endif
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <inifile.h>
|
||||
#include <version.h>
|
||||
#include <video.h>
|
||||
#include <reactos/buildno.h>
|
||||
|
||||
ULONG UiScreenWidth = 80; // Screen Width
|
||||
ULONG UiScreenHeight = 25; // Screen Height
|
||||
|
@ -196,6 +197,39 @@ BOOL UiInitialize(BOOLEAN ShowGui)
|
|||
|
||||
UserInterfaceUp = TRUE;
|
||||
|
||||
DbgPrint((DPRINT_UI, "UiInitialize() returning TRUE.\n"));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL SetupUiInitialize(VOID)
|
||||
{
|
||||
|
||||
CHAR DisplayModeText[260];
|
||||
ULONG Depth;
|
||||
|
||||
|
||||
DisplayModeText[0] = '\0';
|
||||
|
||||
|
||||
UiDisplayMode = MachVideoSetDisplayMode(DisplayModeText, TRUE);
|
||||
MachVideoGetDisplaySize(&UiScreenWidth, &UiScreenHeight, &Depth);
|
||||
|
||||
TuiInitialize();
|
||||
|
||||
// Draw the backdrop and fade it in if special effects are enabled
|
||||
TuiFillArea(0,
|
||||
0,
|
||||
UiScreenWidth - 1,
|
||||
UiScreenHeight - 2,
|
||||
0,
|
||||
ATTR(UiBackdropFgColor, UiBackdropBgColor));
|
||||
|
||||
UiStatusBarBgColor = 7;
|
||||
UserInterfaceUp = TRUE;
|
||||
|
||||
TuiDrawText(4, 1, "ReactOS " KERNEL_VERSION_STR " Setup", ATTR(COLOR_GRAY, UiBackdropBgColor));
|
||||
TuiDrawText(3, 2, "\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD\xCD", ATTR(COLOR_GRAY, UiBackdropBgColor));
|
||||
|
||||
DbgPrint((DPRINT_UI, "UiInitialize() returning TRUE.\n"));
|
||||
|
||||
return TRUE;
|
||||
|
|
|
@ -46,6 +46,9 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E975-E325-11CE-BFC1-08002BE103
|
|||
HKLM,"SYSTEM\CurrentControlSet\Control\ComputerName",,0x00000012
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName",0x00000002,"COMPUTERNAME"
|
||||
|
||||
; Device classes key
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\DeviceClasses",,0x00000012
|
||||
|
||||
; Hardware profile settings
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB",,0x00000012
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB","CurrentConfig",0x00010001,0x00000000
|
||||
|
@ -529,7 +532,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Class2","Type",0x00010001,0x00000001
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","Group",0x00000000,"Debug"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","ImagePath",0x00020000,"system32\drivers\debugout.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","Start",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","Start",0x00010001,0x00000004
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\DebugOut","Type",0x00010001,0x00000001
|
||||
|
||||
; Disk class driver
|
||||
|
@ -675,7 +678,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Ndis","Type",0x00010001,0x00000001
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ErrorControl",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Group",0x00000000,"NDIS"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","ImagePath",0x00020000,"system32\drivers\ne2000.sys"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Start",0x00010001,0x00000004
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Start",0x00010001,0x00000003
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne2000","Route",0x00000000,"Ne20001"
|
||||
|
||||
|
@ -687,8 +690,8 @@ HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE103
|
|||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001\Linkage","Export",0x00000000,"\Device\Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001\Linkage","RootDevice",0x00000000,"Ne20001"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001\Linkage","UpperBind",0x00000000,"Tcpip"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Port",0x00000000,"280"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Irq",0x00000000,"9"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Port",0x00000000,"c100"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","Irq",0x00000000,"B"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}\0001","NetworkAddress",0x00000000,"001122334455"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","DefaultGateway",0x00010000,"0.0.0.0"
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Ne20001\Parameters\Tcpip","IPAddress",0x00010000,"0.0.0.0"
|
||||
|
@ -926,6 +929,12 @@ HKLM,"SYSTEM\CurrentControlSet\Services\VBE","Start",0x00010001,0x00000004
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\VBE","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\VBE\Device0","InstalledDisplayDrivers",0x00010000,"framebuf"
|
||||
|
||||
HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\VBE\Device0","DefaultSettings.VRefresh",0x00010001,1
|
||||
HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\VBE\Device0","DefaultSettings.BitsPerPel",0x00010001,8
|
||||
HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\VBE\Device0","DefaultSettings.XResolution",0x00010001,640
|
||||
HKLM,"SYSTEM\CurrentControlSet\Hardware Profiles\Current\System\CurrentControlSet\Services\VBE\Device0","DefaultSettings.YResolution",0x00010001,480
|
||||
|
||||
|
||||
; VGA miniport driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Vga","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Vga","Group",0x00000000,"Video Save"
|
||||
|
@ -934,6 +943,7 @@ HKLM,"SYSTEM\CurrentControlSet\Services\Vga","Start",0x00010001,0x00000004
|
|||
HKLM,"SYSTEM\CurrentControlSet\Services\Vga","Type",0x00010001,0x00000001
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\Vga\Device0","InstalledDisplayDrivers",0x00010000,"vgaddi"
|
||||
|
||||
|
||||
; VMware SVGA driver
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga","ErrorControl",0x00010001,0x00000000
|
||||
HKLM,"SYSTEM\CurrentControlSet\Services\vmx_svga","Group",0x00000000,"Video"
|
||||
|
|
|
@ -16,7 +16,7 @@ Signature = "$ReactOS$"
|
|||
1 = system32
|
||||
2 = system32\drivers
|
||||
3 = media\fonts
|
||||
4 = .
|
||||
4 =
|
||||
5 = system32\drivers\etc
|
||||
6 = inf
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ DriverEntry(
|
|||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
DbgPrint("Advanced Configuration and Power Interface Bus Driver\n");
|
||||
DPRINT("Advanced Configuration and Power Interface Bus Driver\n");
|
||||
|
||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = (PDRIVER_DISPATCH) ACPIDispatchDeviceControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = (PDRIVER_DISPATCH) ACPIPnpControl;
|
||||
|
|
|
@ -119,12 +119,16 @@ AcpiCreateInstanceIDString(PUNICODE_STRING InstanceID,
|
|||
static BOOLEAN
|
||||
AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
||||
PULONG ResourceListSize,
|
||||
PIO_RESOURCE_REQUIREMENTS_LIST* pRequirementsList,
|
||||
PULONG RequirementsListSize,
|
||||
RESOURCE* resources)
|
||||
{
|
||||
BOOLEAN Done;
|
||||
ULONG NumberOfResources = 0;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
PIO_RESOURCE_REQUIREMENTS_LIST RequirementsList;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
|
||||
PIO_RESOURCE_DESCRIPTOR RequirementDescriptor;
|
||||
RESOURCE* resource;
|
||||
ULONG i;
|
||||
KIRQL Dirql;
|
||||
|
@ -176,6 +180,24 @@ AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
|||
ResourceList->List[0].PartialResourceList.Count = NumberOfResources;
|
||||
ResourceDescriptor = ResourceList->List[0].PartialResourceList.PartialDescriptors;
|
||||
|
||||
*RequirementsListSize = sizeof(IO_RESOURCE_REQUIREMENTS_LIST) + sizeof(IO_RESOURCE_DESCRIPTOR) * (NumberOfResources - 1);
|
||||
RequirementsList = (PIO_RESOURCE_REQUIREMENTS_LIST)ExAllocatePool(PagedPool, *RequirementsListSize);
|
||||
*pRequirementsList = RequirementsList;
|
||||
if (!RequirementsList)
|
||||
{
|
||||
ExFreePool(ResourceList);
|
||||
return FALSE;
|
||||
}
|
||||
RequirementsList->ListSize = *RequirementsListSize;
|
||||
RequirementsList->InterfaceType = ResourceList->List[0].InterfaceType;
|
||||
RequirementsList->BusNumber = ResourceList->List[0].BusNumber;
|
||||
RequirementsList->SlotNumber = 0; /* Not used by WDM drivers */
|
||||
RequirementsList->AlternativeLists = 1;
|
||||
RequirementsList->List[0].Version = 1;
|
||||
RequirementsList->List[0].Revision = 1;
|
||||
RequirementsList->List[0].Count = NumberOfResources;
|
||||
RequirementDescriptor = RequirementsList->List[0].Descriptors;
|
||||
|
||||
/* Fill resources list structure */
|
||||
Done = FALSE;
|
||||
resource = resources;
|
||||
|
@ -199,7 +221,16 @@ AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
|||
&Dirql,
|
||||
&ResourceDescriptor->u.Interrupt.Affinity);
|
||||
ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
|
||||
|
||||
RequirementDescriptor->Option = 0; /* Required */
|
||||
RequirementDescriptor->Type = ResourceDescriptor->Type;
|
||||
RequirementDescriptor->ShareDisposition = ResourceDescriptor->ShareDisposition;
|
||||
RequirementDescriptor->Flags = ResourceDescriptor->Flags;
|
||||
RequirementDescriptor->u.Interrupt.MinimumVector = RequirementDescriptor->u.Interrupt.MaximumVector
|
||||
= irq_data->interrupts[i];
|
||||
|
||||
ResourceDescriptor++;
|
||||
RequirementDescriptor++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -225,7 +256,16 @@ AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
|||
case TRANSFER_8_16: ResourceDescriptor->Flags |= CM_RESOURCE_DMA_8_AND_16; break;
|
||||
}
|
||||
ResourceDescriptor->u.Dma.Channel = dma_data->channels[i];
|
||||
|
||||
RequirementDescriptor->Option = 0; /* Required */
|
||||
RequirementDescriptor->Type = ResourceDescriptor->Type;
|
||||
RequirementDescriptor->ShareDisposition = ResourceDescriptor->ShareDisposition;
|
||||
RequirementDescriptor->Flags = ResourceDescriptor->Flags;
|
||||
RequirementDescriptor->u.Dma.MinimumChannel = RequirementDescriptor->u.Dma.MaximumChannel
|
||||
= ResourceDescriptor->u.Dma.Channel;
|
||||
|
||||
ResourceDescriptor++;
|
||||
RequirementDescriptor++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -242,7 +282,18 @@ AcpiCreateResourceList(PCM_RESOURCE_LIST* pResourceList,
|
|||
ResourceDescriptor->u.Port.Start.u.HighPart = 0;
|
||||
ResourceDescriptor->u.Port.Start.u.LowPart = io_data->min_base_address;
|
||||
ResourceDescriptor->u.Port.Length = io_data->range_length;
|
||||
|
||||
RequirementDescriptor->Option = 0; /* Required */
|
||||
RequirementDescriptor->Type = ResourceDescriptor->Type;
|
||||
RequirementDescriptor->ShareDisposition = ResourceDescriptor->ShareDisposition;
|
||||
RequirementDescriptor->Flags = ResourceDescriptor->Flags;
|
||||
RequirementDescriptor->u.Port.Length = ResourceDescriptor->u.Port.Length;
|
||||
RequirementDescriptor->u.Port.Alignment = 1; /* Start address is specified, so it doesn't matter */
|
||||
RequirementDescriptor->u.Port.MinimumAddress = RequirementDescriptor->u.Port.MaximumAddress
|
||||
= ResourceDescriptor->u.Port.Start;
|
||||
|
||||
ResourceDescriptor++;
|
||||
RequirementDescriptor++;
|
||||
break;
|
||||
}
|
||||
case end_tag:
|
||||
|
@ -366,6 +417,8 @@ FdoQueryBusRelations(
|
|||
}
|
||||
if (!AcpiCreateResourceList(&PdoDeviceExtension->ResourceList,
|
||||
&PdoDeviceExtension->ResourceListSize,
|
||||
&PdoDeviceExtension->ResourceRequirementsList,
|
||||
&PdoDeviceExtension->ResourceRequirementsListSize,
|
||||
(RESOURCE*)Buffer.pointer))
|
||||
{
|
||||
ASSERT(FALSE);
|
||||
|
@ -573,7 +626,9 @@ FdoStartDevice(
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
ACPIPrintInfo(DeviceExtension);
|
||||
#endif
|
||||
|
||||
/* Initialize ACPI bus manager */
|
||||
AcpiStatus = bm_initialize();
|
||||
|
|
|
@ -50,6 +50,9 @@ typedef struct _PDO_DEVICE_EXTENSION
|
|||
// Resource list
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
ULONG ResourceListSize;
|
||||
// Requirement list
|
||||
PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirementsList;
|
||||
ULONG ResourceRequirementsListSize;
|
||||
} PDO_DEVICE_EXTENSION, *PPDO_DEVICE_EXTENSION;
|
||||
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ acpi_os_vprintf(const NATIVE_CHAR *fmt, va_list args)
|
|||
static char Buffer[512];
|
||||
LONG Size = vsprintf(Buffer, fmt, args);
|
||||
|
||||
DbgPrint("%s", Buffer);
|
||||
DPRINT("%s", Buffer);
|
||||
return Size;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,6 +107,35 @@ PdoQueryId(
|
|||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
PdoQueryResourceRequirements(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PIRP Irp,
|
||||
PIO_STACK_LOCATION IrpSp)
|
||||
{
|
||||
PPDO_DEVICE_EXTENSION DeviceExtension;
|
||||
PIO_RESOURCE_REQUIREMENTS_LIST ResourceRequirementsList;
|
||||
|
||||
DeviceExtension = (PPDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
|
||||
|
||||
if (DeviceExtension->ResourceRequirementsListSize == 0)
|
||||
{
|
||||
return Irp->IoStatus.Status;
|
||||
}
|
||||
|
||||
ResourceRequirementsList = ExAllocatePool(PagedPool, DeviceExtension->ResourceRequirementsListSize);
|
||||
if (!ResourceRequirementsList)
|
||||
{
|
||||
Irp->IoStatus.Information = 0;
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
RtlCopyMemory(ResourceRequirementsList, DeviceExtension->ResourceRequirementsList, DeviceExtension->ResourceRequirementsListSize);
|
||||
Irp->IoStatus.Information = (ULONG_PTR)ResourceRequirementsList;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static NTSTATUS
|
||||
PdoQueryResources(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
|
@ -227,6 +256,9 @@ PdoPnpControl(
|
|||
break;
|
||||
|
||||
case IRP_MN_QUERY_RESOURCE_REQUIREMENTS:
|
||||
Status = PdoQueryResourceRequirements(DeviceObject,
|
||||
Irp,
|
||||
IrpSp);
|
||||
break;
|
||||
|
||||
case IRP_MN_QUERY_RESOURCES:
|
||||
|
|
|
@ -172,7 +172,7 @@ DriverEntry(
|
|||
IN PDRIVER_OBJECT DriverObject,
|
||||
IN PUNICODE_STRING RegistryPath)
|
||||
{
|
||||
DbgPrint("Peripheral Component Interconnect Bus Driver\n");
|
||||
DPRINT("Peripheral Component Interconnect Bus Driver\n");
|
||||
|
||||
DriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = PciDispatchDeviceControl;
|
||||
DriverObject->MajorFunction[IRP_MJ_PNP] = PciPnpControl;
|
||||
|
|
|
@ -409,6 +409,8 @@ PdoQueryResourceRequirements(
|
|||
|
||||
ResourceList->ListSize = ListSize;
|
||||
ResourceList->InterfaceType = PCIBus;
|
||||
ResourceList->BusNumber = DeviceExtension->BusNumber,
|
||||
ResourceList->SlotNumber = DeviceExtension->SlotNumber.u.AsULONG,
|
||||
ResourceList->AlternativeLists = 1;
|
||||
|
||||
ResourceList->List[0].Version = 1;
|
||||
|
@ -433,7 +435,7 @@ PdoQueryResourceRequirements(
|
|||
if (Length == 0)
|
||||
{
|
||||
DPRINT("Unused address register\n");
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Set preferred descriptor */
|
||||
|
@ -497,6 +499,7 @@ PdoQueryResourceRequirements(
|
|||
|
||||
if (PciConfig.u.type0.InterruptPin != 0)
|
||||
{
|
||||
Descriptor->Option = 0; /* Required */
|
||||
Descriptor->Type = CmResourceTypeInterrupt;
|
||||
Descriptor->ShareDisposition = CmResourceShareShared;
|
||||
Descriptor->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
|
||||
|
@ -522,7 +525,7 @@ PdoQueryResourceRequirements(
|
|||
if (Length == 0)
|
||||
{
|
||||
DPRINT("Unused address register\n");
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Set preferred descriptor */
|
||||
|
@ -722,7 +725,7 @@ PdoQueryResources(
|
|||
if (Length == 0)
|
||||
{
|
||||
DPRINT("Unused address register\n");
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Flags & PCI_ADDRESS_IO_SPACE)
|
||||
|
@ -776,7 +779,7 @@ PdoQueryResources(
|
|||
if (Length == 0)
|
||||
{
|
||||
DPRINT("Unused address register\n");
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Flags & PCI_ADDRESS_IO_SPACE)
|
||||
|
|
|
@ -83,12 +83,13 @@ DetectLegacyDevice(
|
|||
{
|
||||
ULONG ResourceListSize;
|
||||
PCM_RESOURCE_LIST ResourceList;
|
||||
PCM_RESOURCE_LIST ResourceListTranslated;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptor;
|
||||
PCM_PARTIAL_RESOURCE_DESCRIPTOR ResourceDescriptorTranslated;
|
||||
BOOLEAN ConflictDetected;
|
||||
UART_TYPE UartType;
|
||||
PDEVICE_OBJECT Pdo = NULL;
|
||||
PDEVICE_OBJECT Fdo;
|
||||
KIRQL Dirql;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* Create resource list */
|
||||
|
@ -96,29 +97,60 @@ DetectLegacyDevice(
|
|||
ResourceList = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG);
|
||||
if (!ResourceList)
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
ResourceList->Count = 1;
|
||||
ResourceList->List[0].InterfaceType = InterfaceTypeUndefined;
|
||||
ResourceList->List[0].BusNumber = -1; /* unknown */
|
||||
ResourceList->List[0].PartialResourceList.Version = 1;
|
||||
ResourceList->List[0].PartialResourceList.Revision = 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = 2;
|
||||
ResourceListTranslated = (PCM_RESOURCE_LIST)ExAllocatePoolWithTag(PagedPool, ResourceListSize, SERIAL_TAG);
|
||||
if (!ResourceListTranslated)
|
||||
{
|
||||
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* Resource header */
|
||||
ResourceList->Count = ResourceListTranslated->Count
|
||||
= 1;
|
||||
ResourceList->List[0].InterfaceType = ResourceListTranslated->List[0].InterfaceType
|
||||
= InterfaceTypeUndefined;
|
||||
ResourceList->List[0].BusNumber = ResourceListTranslated->List[0].BusNumber
|
||||
= -1; /* unknown */
|
||||
ResourceList->List[0].PartialResourceList.Version = ResourceListTranslated->List[0].PartialResourceList.Version
|
||||
= 1;
|
||||
ResourceList->List[0].PartialResourceList.Revision = ResourceListTranslated->List[0].PartialResourceList.Revision
|
||||
= 1;
|
||||
ResourceList->List[0].PartialResourceList.Count = ResourceListTranslated->List[0].PartialResourceList.Count
|
||||
= 2;
|
||||
|
||||
/* I/O port */
|
||||
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[0];
|
||||
ResourceDescriptor->Type = CmResourceTypePort;
|
||||
ResourceDescriptor->ShareDisposition = CmResourceShareDriverExclusive;
|
||||
ResourceDescriptor->Flags = CM_RESOURCE_PORT_IO;
|
||||
ResourceDescriptor->u.Port.Start.u.HighPart = 0;
|
||||
ResourceDescriptor->u.Port.Start.u.LowPart = ComPortBase;
|
||||
ResourceDescriptor->u.Port.Length = 8;
|
||||
ResourceDescriptorTranslated = &ResourceListTranslated->List[0].PartialResourceList.PartialDescriptors[0];
|
||||
ResourceDescriptor->Type = ResourceDescriptorTranslated->Type
|
||||
= CmResourceTypePort;
|
||||
ResourceDescriptor->ShareDisposition = ResourceDescriptorTranslated->ShareDisposition
|
||||
= CmResourceShareDriverExclusive;
|
||||
ResourceDescriptor->Flags = ResourceDescriptorTranslated->Flags
|
||||
= CM_RESOURCE_PORT_IO;
|
||||
ResourceDescriptor->u.Port.Start.u.HighPart = ResourceDescriptorTranslated->u.Port.Start.u.HighPart
|
||||
= 0;
|
||||
ResourceDescriptor->u.Port.Start.u.LowPart = ResourceDescriptorTranslated->u.Port.Start.u.LowPart
|
||||
= ComPortBase;
|
||||
ResourceDescriptor->u.Port.Length = ResourceDescriptorTranslated->u.Port.Length
|
||||
= 8;
|
||||
|
||||
ResourceDescriptor = &ResourceList->List[0].PartialResourceList.PartialDescriptors[1];
|
||||
ResourceDescriptor->Type = CmResourceTypeInterrupt;
|
||||
ResourceDescriptor->ShareDisposition = CmResourceShareShared;
|
||||
ResourceDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
|
||||
ResourceDescriptor->u.Interrupt.Vector = HalGetInterruptVector(
|
||||
Internal, 0, 0, Irq,
|
||||
&Dirql,
|
||||
ResourceDescriptorTranslated = &ResourceListTranslated->List[0].PartialResourceList.PartialDescriptors[1];
|
||||
ResourceDescriptor->Type = ResourceDescriptorTranslated->Type
|
||||
= CmResourceTypeInterrupt;
|
||||
ResourceDescriptor->ShareDisposition = ResourceDescriptorTranslated->ShareDisposition
|
||||
= CmResourceShareShared;
|
||||
ResourceDescriptor->Flags = ResourceDescriptorTranslated->Flags
|
||||
= CM_RESOURCE_INTERRUPT_LATCHED;
|
||||
ResourceDescriptor->u.Interrupt.Level = Irq;
|
||||
ResourceDescriptorTranslated->u.Interrupt.Vector = HalGetInterruptVector(
|
||||
ResourceList->List[0].InterfaceType,
|
||||
ResourceList->List[0].BusNumber,
|
||||
ResourceDescriptor->u.Interrupt.Level,
|
||||
ResourceDescriptor->u.Interrupt.Vector,
|
||||
(PKIRQL)&ResourceDescriptorTranslated->u.Interrupt.Level,
|
||||
&ResourceDescriptor->u.Interrupt.Affinity);
|
||||
ResourceDescriptor->u.Interrupt.Level = (ULONG)Dirql;
|
||||
ResourceDescriptorTranslated->u.Interrupt.Affinity = ResourceDescriptor->u.Interrupt.Affinity;
|
||||
|
||||
/* Report resource list */
|
||||
Status = IoReportResourceForDetection(
|
||||
|
@ -129,11 +161,13 @@ DetectLegacyDevice(
|
|||
{
|
||||
DPRINT("Serial: conflict detected for serial port at 0x%lx (Irq %lu)\n", ComPortBase, Irq);
|
||||
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
|
||||
ExFreePoolWithTag(ResourceListTranslated, SERIAL_TAG);
|
||||
return STATUS_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
|
||||
ExFreePoolWithTag(ResourceListTranslated, SERIAL_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -154,7 +188,7 @@ DetectLegacyDevice(
|
|||
Status = SerialAddDeviceInternal(DriverObject, Pdo, UartType, pComPortNumber, &Fdo);
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
Status = SerialPnpStartDevice(Fdo, ResourceList);
|
||||
Status = SerialPnpStartDevice(Fdo, ResourceList, ResourceListTranslated);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -168,6 +202,7 @@ DetectLegacyDevice(
|
|||
Status = STATUS_DEVICE_NOT_CONNECTED;
|
||||
}
|
||||
ExFreePoolWithTag(ResourceList, SERIAL_TAG);
|
||||
ExFreePoolWithTag(ResourceListTranslated, SERIAL_TAG);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,8 @@ SerialAddDevice(
|
|||
NTSTATUS STDCALL
|
||||
SerialPnpStartDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PCM_RESOURCE_LIST ResourceList)
|
||||
IN PCM_RESOURCE_LIST ResourceList,
|
||||
IN PCM_RESOURCE_LIST ResourceListTranslated)
|
||||
{
|
||||
PSERIAL_DEVICE_EXTENSION DeviceExtension;
|
||||
WCHAR DeviceNameBuffer[32];
|
||||
|
@ -174,8 +175,8 @@ SerialPnpStartDevice(
|
|||
case CmResourceTypeInterrupt:
|
||||
if (Dirql != 0)
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
Dirql = (KIRQL)PartialDescriptor->u.Interrupt.Level;
|
||||
Vector = PartialDescriptor->u.Interrupt.Vector;
|
||||
Dirql = (KIRQL)ResourceListTranslated->List[i].PartialResourceList.PartialDescriptors[j].u.Interrupt.Level;
|
||||
Vector = ResourceListTranslated->List[i].PartialResourceList.PartialDescriptors[j].u.Interrupt.Vector;
|
||||
Affinity = PartialDescriptor->u.Interrupt.Affinity;
|
||||
if (PartialDescriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
|
||||
InterruptMode = Latched;
|
||||
|
@ -338,16 +339,9 @@ SerialPnp(
|
|||
BOOLEAN ConflictDetected;
|
||||
DPRINT("Serial: IRP_MJ_PNP / IRP_MN_START_DEVICE\n");
|
||||
|
||||
/* FIXME: first HACK: PnP manager can send multiple
|
||||
* IRP_MN_START_DEVICE for one device
|
||||
*/
|
||||
if (((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->PnpState != dsStopped)
|
||||
{
|
||||
DPRINT1("Serial: device already started. Ignoring this irp!\n");
|
||||
Status = STATUS_SUCCESS;
|
||||
break;
|
||||
}
|
||||
/* FIXME: second HACK: verify that we have some allocated resources.
|
||||
ASSERT(((PSERIAL_DEVICE_EXTENSION)DeviceObject->DeviceExtension)->PnpState == dsStopped);
|
||||
|
||||
/* FIXME: HACK: verify that we have some allocated resources.
|
||||
* It seems not to be always the case on some hardware
|
||||
*/
|
||||
if (Stack->Parameters.StartDevice.AllocatedResources == NULL)
|
||||
|
@ -357,7 +351,7 @@ SerialPnp(
|
|||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
break;
|
||||
}
|
||||
/* FIXME: third HACK: verify that we don't have resource conflict,
|
||||
/* FIXME: HACK: verify that we don't have resource conflict,
|
||||
* because PnP manager doesn't do it automatically
|
||||
*/
|
||||
Status = IoReportResourceForDetection(
|
||||
|
@ -377,7 +371,8 @@ SerialPnp(
|
|||
if (NT_SUCCESS(Status))
|
||||
Status = SerialPnpStartDevice(
|
||||
DeviceObject,
|
||||
Stack->Parameters.StartDevice.AllocatedResources);
|
||||
Stack->Parameters.StartDevice.AllocatedResources,
|
||||
Stack->Parameters.StartDevice.AllocatedResourcesTranslated);
|
||||
break;
|
||||
}
|
||||
case IRP_MN_QUERY_DEVICE_RELATIONS: /* (optional) 0x7 */
|
||||
|
|
|
@ -327,7 +327,8 @@ SerialAddDevice(
|
|||
NTSTATUS STDCALL
|
||||
SerialPnpStartDevice(
|
||||
IN PDEVICE_OBJECT DeviceObject,
|
||||
IN PCM_RESOURCE_LIST ResourceList);
|
||||
IN PCM_RESOURCE_LIST ResourceList,
|
||||
IN PCM_RESOURCE_LIST ResourceListTranslated);
|
||||
|
||||
NTSTATUS STDCALL
|
||||
SerialPnp(
|
||||
|
|
|
@ -96,7 +96,7 @@ NpfsSignalAndRemoveListeningServerInstance(PNPFS_PIPE Pipe,
|
|||
|
||||
RemoveEntryList(&Waiter->Entry);
|
||||
Irp = CONTAINING_RECORD(Waiter, IRP, Tail.Overlay.DriverContext);
|
||||
Irp->IoStatus.Status = STATUS_PIPE_CONNECTED;
|
||||
Irp->IoStatus.Status = STATUS_SUCCESS;
|
||||
Irp->IoStatus.Information = 0;
|
||||
IoCompleteRequest(Irp, IO_NO_INCREMENT);
|
||||
break;
|
||||
|
|
|
@ -86,7 +86,7 @@ typedef struct _I8042_SETTINGS
|
|||
DWORD OverrideKeyboardType;
|
||||
DWORD OverrideKeyboardSubtype;
|
||||
DWORD MouseResendStallTime;
|
||||
DWORD MouseSynchIn100ns;
|
||||
DWORD MouseSynchIn100ns; /* done */
|
||||
DWORD MouseResolution; /* done */
|
||||
DWORD NumberOfButtons;
|
||||
DWORD EnableWheelDetection;
|
||||
|
@ -169,6 +169,7 @@ typedef struct _DEVICE_EXTENSION
|
|||
MOUSE_INPUT_DATA *MouseBuffer;
|
||||
ULONG MouseInBuffer;
|
||||
USHORT MouseButtonState;
|
||||
ULARGE_INTEGER MousePacketStartTime;
|
||||
|
||||
UCHAR MouseLogiBuffer[3];
|
||||
UCHAR MouseLogitechID;
|
||||
|
|
|
@ -113,7 +113,7 @@ BOOLEAN STDCALL I8042InterruptServiceKbd(struct _KINTERRUPT *Interrupt,
|
|||
} while (Iterations < DevExt->Settings.PollStatusIterations);
|
||||
|
||||
if (STATUS_SUCCESS != Status) {
|
||||
DPRINT1("Spurious I8042 interrupt\n");
|
||||
DPRINT("Spurious I8042 interrupt\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,39 @@ NTSTATUS STDCALL I8042SynchWritePortMouse(PVOID Context,
|
|||
WaitForAck);
|
||||
}
|
||||
|
||||
/* Test if packets are taking too long to come in. If they do, we
|
||||
* might have gotten out of sync and should just drop what we have.
|
||||
*
|
||||
* If we want to be totally right, we'd also have to keep a count of
|
||||
* errors, and totally reset the mouse after too much of them (can
|
||||
* happen if the user is using a KVM switch and an OS on another port
|
||||
* resets the mouse, or if the user hotplugs the mouse, or if we're just
|
||||
* generally unlucky). Also note the input parsing routine where we
|
||||
* drop invalid input packets.
|
||||
*/
|
||||
static VOID STDCALL I8042MouseInputTestTimeout(PDEVICE_EXTENSION DevExt)
|
||||
{
|
||||
ULARGE_INTEGER Now;
|
||||
|
||||
if (DevExt->MouseState == MouseExpectingACK ||
|
||||
DevExt->MouseState == MouseResetting)
|
||||
return;
|
||||
|
||||
Now.QuadPart = KeQueryInterruptTime();
|
||||
|
||||
if (DevExt->MouseState != MouseIdle) {
|
||||
/* Check if the last byte came too long ago */
|
||||
if (Now.QuadPart - DevExt->MousePacketStartTime.QuadPart >
|
||||
DevExt->Settings.MouseSynchIn100ns) {
|
||||
DPRINT1("Mouse input packet timeout\n");
|
||||
DevExt->MouseState = MouseIdle;
|
||||
}
|
||||
}
|
||||
|
||||
if (DevExt->MouseState == MouseIdle)
|
||||
DevExt->MousePacketStartTime.QuadPart = Now.QuadPart;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call the customization hook. The Ret2 parameter is about wether
|
||||
* we should go on with the interrupt. The return value is what
|
||||
|
@ -301,7 +334,7 @@ BOOLEAN STDCALL I8042MouseResetIsr(PDEVICE_EXTENSION DevExt,
|
|||
case ExpectingFinalResolutionACK:
|
||||
I8042IsrWritePortMouse(DevExt,
|
||||
DevExt->Settings.MouseResolution & 0xff);
|
||||
DPRINT1("%x\n", DevExt->Settings.MouseResolution);
|
||||
DPRINT("%x\n", DevExt->Settings.MouseResolution);
|
||||
DevExt->MouseResetState = ExpectingFinalResolutionValueACK;
|
||||
return TRUE;
|
||||
case ExpectingFinalResolutionValueACK:
|
||||
|
@ -517,6 +550,8 @@ BOOLEAN STDCALL I8042InterruptServiceMouse(struct _KINTERRUPT *Interrupt,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
I8042MouseInputTestTimeout(DevExt);
|
||||
|
||||
if (I8042MouseResetIsr(DevExt, PortStatus, &Output)) {
|
||||
DPRINT("Handled by ResetIsr or hooked Isr\n");
|
||||
if (NoChange != DevExt->MouseTimeoutState) {
|
||||
|
|
|
@ -141,7 +141,7 @@ AfdGetSockOrPeerName( PDEVICE_OBJECT DeviceObject, PIRP Irp,
|
|||
}
|
||||
|
||||
/* MmUnlockPages( Mdl ); */
|
||||
IoFreeMdl( Mdl );
|
||||
/* IoFreeMdl( Mdl ); */
|
||||
} else {
|
||||
Status = STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include <ndissys.h>
|
||||
|
||||
struct _ADAPTER_BINDING;
|
||||
|
||||
typedef struct _HARDWARE_ADDRESS {
|
||||
union {
|
||||
|
@ -77,9 +78,9 @@ typedef struct _LOGICAL_ADAPTER
|
|||
KDPC MiniportDpc; /* DPC routine for adapter */
|
||||
BOOLEAN MiniportBusy; /* A MiniportXxx routine is executing */
|
||||
ULONG WorkQueueLevel; /* Number of used work item buffers */
|
||||
NDIS_MINIPORT_WORK_ITEM WorkQueue[NDIS_MINIPORT_WORK_QUEUE_SIZE];
|
||||
PNDIS_MINIPORT_WORK_ITEM WorkQueueHead; /* Head of work queue */
|
||||
PNDIS_MINIPORT_WORK_ITEM WorkQueueTail; /* Tail of work queue */
|
||||
INTERNAL_NDIS_MINIPORT_WORK_ITEM WorkQueue[NDIS_MINIPORT_WORK_QUEUE_SIZE];
|
||||
PINTERNAL_NDIS_MINIPORT_WORK_ITEM WorkQueueHead; /* Head of work queue */
|
||||
PINTERNAL_NDIS_MINIPORT_WORK_ITEM WorkQueueTail; /* Tail of work queue */
|
||||
LIST_ENTRY ListEntry; /* Entry on global list */
|
||||
LIST_ENTRY MiniportListEntry; /* Entry on miniport driver list */
|
||||
LIST_ENTRY ProtocolListHead; /* List of bound protocols */
|
||||
|
@ -145,7 +146,7 @@ MiniQueryInformation(
|
|||
NDIS_STATUS
|
||||
FASTCALL
|
||||
MiniQueueWorkItem(
|
||||
PLOGICAL_ADAPTER Adapter,
|
||||
struct _ADAPTER_BINDING *AdapterBinding,
|
||||
NDIS_WORK_ITEM_TYPE WorkItemType,
|
||||
PVOID WorkItemContext);
|
||||
|
||||
|
@ -153,12 +154,13 @@ NDIS_STATUS
|
|||
FASTCALL
|
||||
MiniDequeueWorkItem(
|
||||
PLOGICAL_ADAPTER Adapter,
|
||||
struct _ADAPTER_BINDING **AdapterBinding,
|
||||
NDIS_WORK_ITEM_TYPE *WorkItemType,
|
||||
PVOID *WorkItemContext);
|
||||
|
||||
NDIS_STATUS
|
||||
MiniDoRequest(
|
||||
PLOGICAL_ADAPTER Adapter,
|
||||
struct _ADAPTER_BINDING *AdapterBinding,
|
||||
PNDIS_REQUEST NdisRequest);
|
||||
|
||||
BOOLEAN
|
||||
|
|
|
@ -27,6 +27,14 @@ typedef struct _ATM_ADDRESS *PATM_ADDRESS;
|
|||
#include <ddk/ntapi.h>
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
struct _ADAPTER_BINDING;
|
||||
|
||||
typedef struct _INTERNAL_NDIS_MINIPORT_WORK_ITEM {
|
||||
SINGLE_LIST_ENTRY Link;
|
||||
struct _ADAPTER_BINDING *AdapterBinding;
|
||||
NDIS_MINIPORT_WORK_ITEM RealWorkItem;
|
||||
} INTERNAL_NDIS_MINIPORT_WORK_ITEM, *PINTERNAL_NDIS_MINIPORT_WORK_ITEM;
|
||||
|
||||
#include "miniport.h"
|
||||
#include "protocol.h"
|
||||
|
||||
|
|
|
@ -327,6 +327,23 @@ MiniResetComplete(
|
|||
}
|
||||
|
||||
|
||||
|
||||
VOID STDCALL
|
||||
MiniRequestComplete(
|
||||
IN PADAPTER_BINDING AdapterBinding,
|
||||
IN PNDIS_REQUEST Request,
|
||||
IN NDIS_STATUS Status)
|
||||
{
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
if( AdapterBinding->ProtocolBinding->Chars.RequestCompleteHandler ) {
|
||||
(*AdapterBinding->ProtocolBinding->Chars.RequestCompleteHandler)(
|
||||
AdapterBinding->NdisOpenBlock.NdisCommonOpenBlock.ProtocolBindingContext,
|
||||
Request,
|
||||
Status);
|
||||
}
|
||||
}
|
||||
|
||||
VOID STDCALL
|
||||
MiniSendComplete(
|
||||
IN NDIS_HANDLE MiniportAdapterHandle,
|
||||
|
@ -615,7 +632,7 @@ MiniQueryInformation(
|
|||
NDIS_STATUS
|
||||
FASTCALL
|
||||
MiniQueueWorkItem(
|
||||
PLOGICAL_ADAPTER Adapter,
|
||||
PADAPTER_BINDING AdapterBinding,
|
||||
NDIS_WORK_ITEM_TYPE WorkItemType,
|
||||
PVOID WorkItemContext)
|
||||
/*
|
||||
|
@ -630,7 +647,8 @@ MiniQueueWorkItem(
|
|||
* Status of operation
|
||||
*/
|
||||
{
|
||||
PNDIS_MINIPORT_WORK_ITEM Item;
|
||||
PINTERNAL_NDIS_MINIPORT_WORK_ITEM Item;
|
||||
PLOGICAL_ADAPTER Adapter = AdapterBinding->Adapter;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
|
@ -646,7 +664,7 @@ MiniQueueWorkItem(
|
|||
else
|
||||
#endif
|
||||
{
|
||||
Item = ExAllocatePool(NonPagedPool, sizeof(NDIS_MINIPORT_WORK_ITEM));
|
||||
Item = ExAllocatePool(NonPagedPool, sizeof(INTERNAL_NDIS_MINIPORT_WORK_ITEM));
|
||||
if (Item == NULL)
|
||||
{
|
||||
NDIS_DbgPrint(MIN_TRACE, ("Insufficient resources.\n"));
|
||||
|
@ -654,8 +672,9 @@ MiniQueueWorkItem(
|
|||
}
|
||||
}
|
||||
|
||||
Item->WorkItemType = WorkItemType;
|
||||
Item->WorkItemContext = WorkItemContext;
|
||||
Item->AdapterBinding = AdapterBinding;
|
||||
Item->RealWorkItem.WorkItemType = WorkItemType;
|
||||
Item->RealWorkItem.WorkItemContext = WorkItemContext;
|
||||
|
||||
/* safe due to adapter lock held */
|
||||
Item->Link.Next = NULL;
|
||||
|
@ -680,12 +699,14 @@ NDIS_STATUS
|
|||
FASTCALL
|
||||
MiniDequeueWorkItem(
|
||||
PLOGICAL_ADAPTER Adapter,
|
||||
PADAPTER_BINDING *AdapterBinding,
|
||||
NDIS_WORK_ITEM_TYPE *WorkItemType,
|
||||
PVOID *WorkItemContext)
|
||||
/*
|
||||
* FUNCTION: Dequeues a work item from the work queue of a logical adapter
|
||||
* ARGUMENTS:
|
||||
* Adapter = Pointer to the logical adapter object to dequeue work item from
|
||||
* AdapterBinding = Address of buffer for adapter binding for this request
|
||||
* WorkItemType = Address of buffer for work item type
|
||||
* WorkItemContext = Address of buffer for pointer to context information
|
||||
* NOTES:
|
||||
|
@ -694,7 +715,7 @@ MiniDequeueWorkItem(
|
|||
* Status of operation
|
||||
*/
|
||||
{
|
||||
PNDIS_MINIPORT_WORK_ITEM Item;
|
||||
PINTERNAL_NDIS_MINIPORT_WORK_ITEM Item;
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Called.\n"));
|
||||
|
||||
|
@ -703,13 +724,14 @@ MiniDequeueWorkItem(
|
|||
if (Item)
|
||||
{
|
||||
/* safe due to adapter lock held */
|
||||
Adapter->WorkQueueHead = (PNDIS_MINIPORT_WORK_ITEM)Item->Link.Next;
|
||||
Adapter->WorkQueueHead = (PINTERNAL_NDIS_MINIPORT_WORK_ITEM)Item->Link.Next;
|
||||
|
||||
if (Item == Adapter->WorkQueueTail)
|
||||
Adapter->WorkQueueTail = NULL;
|
||||
|
||||
*WorkItemType = Item->WorkItemType;
|
||||
*WorkItemContext = Item->WorkItemContext;
|
||||
*AdapterBinding = Item->AdapterBinding;
|
||||
*WorkItemType = Item->RealWorkItem.WorkItemType;
|
||||
*WorkItemContext = Item->RealWorkItem.WorkItemContext;
|
||||
|
||||
ExFreePool(Item);
|
||||
|
||||
|
@ -722,17 +744,19 @@ MiniDequeueWorkItem(
|
|||
|
||||
NDIS_STATUS
|
||||
MiniDoRequest(
|
||||
PLOGICAL_ADAPTER Adapter,
|
||||
PADAPTER_BINDING AdapterBinding,
|
||||
PNDIS_REQUEST NdisRequest)
|
||||
/*
|
||||
* FUNCTION: Sends a request to a miniport
|
||||
* ARGUMENTS:
|
||||
* Adapter = Pointer to logical adapter object
|
||||
* AdapterBinding = Pointer to binding used in the request
|
||||
* NdisRequest = Pointer to NDIS request structure describing request
|
||||
* RETURNS:
|
||||
* Status of operation
|
||||
*/
|
||||
{
|
||||
PLOGICAL_ADAPTER Adapter = AdapterBinding->Adapter;
|
||||
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
Adapter->NdisMiniportBlock.MediaRequest = NdisRequest;
|
||||
|
@ -800,11 +824,14 @@ VOID STDCALL MiniportDpc(
|
|||
NDIS_STATUS NdisStatus;
|
||||
PVOID WorkItemContext;
|
||||
NDIS_WORK_ITEM_TYPE WorkItemType;
|
||||
PADAPTER_BINDING AdapterBinding;
|
||||
PLOGICAL_ADAPTER Adapter = GET_LOGICAL_ADAPTER(DeferredContext);
|
||||
|
||||
NDIS_DbgPrint(DEBUG_MINIPORT, ("Called.\n"));
|
||||
|
||||
NdisStatus = MiniDequeueWorkItem(Adapter, &WorkItemType, &WorkItemContext);
|
||||
NdisStatus =
|
||||
MiniDequeueWorkItem
|
||||
(Adapter, &AdapterBinding, &WorkItemType, &WorkItemContext);
|
||||
|
||||
if (NdisStatus == NDIS_STATUS_SUCCESS)
|
||||
{
|
||||
|
@ -873,7 +900,7 @@ VOID STDCALL MiniportDpc(
|
|||
break;
|
||||
|
||||
case NdisWorkItemRequest:
|
||||
NdisStatus = MiniDoRequest(Adapter, (PNDIS_REQUEST)WorkItemContext);
|
||||
NdisStatus = MiniDoRequest(AdapterBinding, (PNDIS_REQUEST)WorkItemContext);
|
||||
|
||||
if (NdisStatus == NDIS_STATUS_PENDING)
|
||||
break;
|
||||
|
@ -882,10 +909,12 @@ VOID STDCALL MiniportDpc(
|
|||
{
|
||||
case NdisRequestQueryInformation:
|
||||
NdisMQueryInformationComplete((NDIS_HANDLE)Adapter, NdisStatus);
|
||||
MiniRequestComplete( AdapterBinding, (PNDIS_REQUEST)WorkItemContext, NdisStatus );
|
||||
break;
|
||||
|
||||
case NdisRequestSetInformation:
|
||||
NdisMSetInformationComplete((NDIS_HANDLE)Adapter, NdisStatus);
|
||||
MiniRequestComplete( AdapterBinding, (PNDIS_REQUEST)WorkItemContext, NdisStatus );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -158,7 +158,7 @@ ProRequest(
|
|||
/* MiniQueueWorkItem must be called at IRQL >= DISPATCH_LEVEL */
|
||||
if (QueueWorkItem)
|
||||
{
|
||||
MiniQueueWorkItem(Adapter, NdisWorkItemRequest, (PVOID)NdisRequest);
|
||||
MiniQueueWorkItem(AdapterBinding, NdisWorkItemRequest, (PVOID)NdisRequest);
|
||||
KeReleaseSpinLock(&Adapter->NdisMiniportBlock.Lock, OldIrql);
|
||||
return NDIS_STATUS_PENDING;
|
||||
}
|
||||
|
@ -169,7 +169,7 @@ ProRequest(
|
|||
/* TODO (?): move the irql raise into MiniDoRequest */
|
||||
KeRaiseIrql(DISPATCH_LEVEL, &OldIrql);
|
||||
{
|
||||
NdisStatus = MiniDoRequest(Adapter, NdisRequest);
|
||||
NdisStatus = MiniDoRequest(AdapterBinding, NdisRequest);
|
||||
|
||||
NDIS_DbgPrint(MAX_TRACE, ("acquiring miniport block lock\n"));
|
||||
KeAcquireSpinLockAtDpcLevel(&Adapter->NdisMiniportBlock.Lock);
|
||||
|
@ -278,7 +278,7 @@ ProSend(
|
|||
|
||||
if (QueueWorkItem)
|
||||
{
|
||||
MiniQueueWorkItem(Adapter, NdisWorkItemSendLoopback, (PVOID)Packet);
|
||||
MiniQueueWorkItem(AdapterBinding, NdisWorkItemSendLoopback, (PVOID)Packet);
|
||||
return NDIS_STATUS_PENDING;
|
||||
}
|
||||
|
||||
|
@ -315,7 +315,7 @@ ProSend(
|
|||
/* This is a normal send packet, not a loopback packet. */
|
||||
if (QueueWorkItem)
|
||||
{
|
||||
MiniQueueWorkItem(Adapter, NdisWorkItemSend, (PVOID)Packet);
|
||||
MiniQueueWorkItem(AdapterBinding, NdisWorkItemSend, (PVOID)Packet);
|
||||
NDIS_DbgPrint(MAX_TRACE, ("Queued a work item and returning\n"));
|
||||
return NDIS_STATUS_PENDING;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
*/
|
||||
#include "precomp.h"
|
||||
|
||||
//#define NDEBUG
|
||||
#define NDEBUG
|
||||
|
||||
#ifndef NDEBUG
|
||||
DWORD DebugTraceLevel = DEBUG_ULTRA & ~(DEBUG_LOCK | DEBUG_PBUFFER);
|
||||
|
|
|
@ -391,17 +391,10 @@ static VOID
|
|||
CdromClassCreateMediaChangeEvent(IN PDEVICE_EXTENSION DeviceExtension,
|
||||
IN ULONG DeviceNumber)
|
||||
{
|
||||
WCHAR NameBuffer[MAX_PATH];
|
||||
UNICODE_STRING Name;
|
||||
|
||||
swprintf (NameBuffer,
|
||||
L"\\Device\\MediaChangeEvent%lu",
|
||||
DeviceNumber);
|
||||
RtlInitUnicodeString (&Name,
|
||||
NameBuffer);
|
||||
|
||||
DeviceExtension->MediaChangeEvent =
|
||||
IoCreateSynchronizationEvent (&Name,
|
||||
IoCreateSynchronizationEvent (NULL,
|
||||
&DeviceExtension->MediaChangeEventHandle);
|
||||
|
||||
KeClearEvent (DeviceExtension->MediaChangeEvent);
|
||||
|
|
|
@ -315,17 +315,8 @@ static VOID
|
|||
DiskClassCreateMediaChangeEvent(IN PDEVICE_EXTENSION DeviceExtension,
|
||||
IN ULONG DeviceNumber)
|
||||
{
|
||||
WCHAR NameBuffer[MAX_PATH];
|
||||
UNICODE_STRING Name;
|
||||
|
||||
swprintf (NameBuffer,
|
||||
L"\\Device\\MediaChangeEvent%lu",
|
||||
DeviceNumber);
|
||||
RtlInitUnicodeString (&Name,
|
||||
NameBuffer);
|
||||
|
||||
DeviceExtension->MediaChangeEvent =
|
||||
IoCreateSynchronizationEvent (&Name,
|
||||
IoCreateSynchronizationEvent (NULL,
|
||||
&DeviceExtension->MediaChangeEventHandle);
|
||||
|
||||
KeClearEvent (DeviceExtension->MediaChangeEvent);
|
||||
|
|
|
@ -6,7 +6,7 @@ PATH_TO_TOP = ../..
|
|||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
DRIVERS = usbport miniport/usbuhci miniport/usbehci miniport/usbohci usbhub usbd
|
||||
DRIVERS = usbport miniport/usbuhci miniport/usbehci miniport/usbohci usbhub usbd cromwell
|
||||
|
||||
all: $(DRIVERS)
|
||||
|
||||
|
|
|
@ -59,7 +59,8 @@
|
|||
*
|
||||
* Store this function in the HCD's struct pci_driver as probe().
|
||||
*/
|
||||
int STDCALL usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
|
||||
int STDCALL
|
||||
usb_hcd_pci_probe (struct pci_dev *dev, const struct pci_device_id *id)
|
||||
{
|
||||
struct hc_driver *driver;
|
||||
PHYSICAL_ADDRESS resource;
|
||||
|
@ -122,7 +123,7 @@ clean_1:
|
|||
dbg ("no i/o regions available");
|
||||
return -EBUSY;
|
||||
}
|
||||
base = NULL; //(void *) resource; // this isn't possible
|
||||
base = (void *) (ULONG_PTR)resource.u.LowPart;
|
||||
}
|
||||
|
||||
// driver->start(), later on, will transfer device from
|
||||
|
|
|
@ -215,7 +215,7 @@ struct hc_driver {
|
|||
const char *description; /* "ehci-hcd" etc */
|
||||
|
||||
/* irq handler */
|
||||
void (*irq) (struct usb_hcd *hcd, struct pt_regs *regs);
|
||||
int (*irq) (struct usb_hcd *hcd, struct pt_regs *regs);
|
||||
|
||||
int flags;
|
||||
#define HCD_MEMORY 0x0001 /* HC regs use memory (else I/O) */
|
||||
|
|
|
@ -1199,8 +1199,8 @@ int usb_hub_init(void)
|
|||
return -1;
|
||||
}
|
||||
|
||||
pid = kernel_thread(hub_thread, NULL,
|
||||
CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
|
||||
pid = kernel_thread((void*)hub_thread, NULL,
|
||||
(CLONE_FS | CLONE_FILES | CLONE_SIGHAND));
|
||||
if (pid >= 0) {
|
||||
khubd_pid = pid;
|
||||
return 0;
|
||||
|
|
|
@ -13,6 +13,9 @@ TARGET_OBJECTS = \
|
|||
buffer_simple.o usb-debug.o ../sys/ros_wrapper.o \
|
||||
../sys/linuxwrapper.o usbcore.o
|
||||
|
||||
TARGET_LIBS = \
|
||||
$(PATH_TO_TOP)/dk/nkm/lib/libusbcore.a
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "hcd.h" /* for usbcore internals */
|
||||
|
||||
// ReactOS specific: No WAITQUEUEs here
|
||||
#undef wake_up
|
||||
#define wake_up(a) do {} while(0)
|
||||
|
||||
struct usb_api_data {
|
||||
|
@ -39,7 +40,7 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int* actual_length)
|
|||
struct usb_api_data awd;
|
||||
int status;
|
||||
|
||||
init_waitqueue_head(&awd.wqh);
|
||||
init_waitqueue_head((PKEVENT)&awd.wqh);
|
||||
awd.done = 0;
|
||||
|
||||
set_current_state(TASK_UNINTERRUPTIBLE);
|
||||
|
|
|
@ -869,12 +869,14 @@ void usb_disconnect(struct usb_device **pdev)
|
|||
might_sleep ();
|
||||
|
||||
if (!dev) {
|
||||
pr_debug ("%s nodev\n", __FUNCTION__);
|
||||
// pr_debug ("%s nodev\n", __FUNCTION__);
|
||||
DPRINT ("%s nodev\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
bus = dev->bus;
|
||||
if (!bus) {
|
||||
pr_debug ("%s nobus\n", __FUNCTION__);
|
||||
// pr_debug ("%s nobus\n", __FUNCTION__);
|
||||
DPRINT ("%s nobus\n", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
ops = bus->op;
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
#include <ddk/ntddk.h>
|
||||
#include <debug.h>
|
||||
|
||||
NTSTATUS AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
|
||||
NTSTATUS STDCALL
|
||||
AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
|
||||
{
|
||||
DbgPrint("usbcore: AddDevice called\n");
|
||||
|
||||
|
@ -19,13 +20,15 @@ NTSTATUS AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
VOID DriverUnload(PDRIVER_OBJECT DriverObject)
|
||||
VOID STDCALL
|
||||
DriverUnload(PDRIVER_OBJECT DriverObject)
|
||||
{
|
||||
// nothing to do here yet
|
||||
}
|
||||
|
||||
// Dispatch PNP
|
||||
NTSTATUS DispatchPnp(PDEVICE_OBJECT fdo, PIRP Irp)
|
||||
NTSTATUS STDCALL
|
||||
DispatchPnp(PDEVICE_OBJECT fdo, PIRP Irp)
|
||||
{
|
||||
ULONG fcn;
|
||||
PIO_STACK_LOCATION stack;
|
||||
|
@ -42,7 +45,8 @@ NTSTATUS DispatchPnp(PDEVICE_OBJECT fdo, PIRP Irp)
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
NTSTATUS DispatchPower(PDEVICE_OBJECT fido, PIRP Irp)
|
||||
NTSTATUS STDCALL
|
||||
DispatchPower(PDEVICE_OBJECT fido, PIRP Irp)
|
||||
{
|
||||
DbgPrint("IRP_MJ_POWER dispatch\n");
|
||||
return STATUS_SUCCESS;
|
||||
|
|
|
@ -520,7 +520,7 @@ static int hc_start (struct ohci_hcd *ohci)
|
|||
(void) readl (&ohci->regs->control);
|
||||
|
||||
// POTPGT delay is bits 24-31, in 2 ms units.
|
||||
mdelay ((roothub_a (ohci) >> 23) & 0x1fe);
|
||||
mdelay (((int)(roothub_a (ohci) >> 23) & 0x1fe));
|
||||
|
||||
/* connect the virtual root hub */
|
||||
bus = hcd_to_bus (&ohci->hcd);
|
||||
|
@ -552,7 +552,8 @@ static int hc_start (struct ohci_hcd *ohci)
|
|||
|
||||
/* an interrupt happens */
|
||||
|
||||
static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
|
||||
static
|
||||
int ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
|
||||
{
|
||||
struct ohci_hcd *ohci = hcd_to_ohci (hcd);
|
||||
struct ohci_regs *regs = ohci->regs;
|
||||
|
@ -567,11 +568,11 @@ static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
|
|||
} else if ((ints = readl (®s->intrstatus)) == ~(u32)0) {
|
||||
disable (ohci);
|
||||
ohci_dbg (ohci, "device removed!\n");
|
||||
return;
|
||||
return 0;
|
||||
|
||||
/* interrupt for some other device? */
|
||||
} else if ((ints &= readl (®s->intrenable)) == 0) {
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ints & OHCI_INTR_UE) {
|
||||
|
@ -606,6 +607,7 @@ static void ohci_irq (struct usb_hcd *hcd, struct pt_regs *ptregs)
|
|||
writel (OHCI_INTR_MIE, ®s->intrenable);
|
||||
// flush those pci writes
|
||||
(void) readl (&ohci->regs->control);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
|
|
@ -31,6 +31,7 @@ typedef struct _OHCI_DEVICE_EXTENSTION
|
|||
ULONG InterruptLevel;
|
||||
PHYSICAL_ADDRESS BaseAddress;
|
||||
ULONG BaseAddrLength;
|
||||
ULONG Flags;
|
||||
ULONG AdapterInterfaceType;
|
||||
ULONG SystemIoBusNumber;
|
||||
ULONG SystemIoSlotNumber;
|
||||
|
|
|
@ -234,8 +234,8 @@ struct pci_driver {
|
|||
struct list_head node;
|
||||
char *name;
|
||||
const struct pci_device_id *id_table; /* must be non-NULL for probe to be called */
|
||||
int (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
|
||||
void (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
|
||||
int STDCALL (*probe) (struct pci_dev *dev, const struct pci_device_id *id); /* New device inserted */
|
||||
void STDCALL (*remove) (struct pci_dev *dev); /* Device removed (NULL if not a hot-plug capable driver) */
|
||||
int (*save_state) (struct pci_dev *dev, u32 state); /* Save Device Context */
|
||||
int (*suspend) (struct pci_dev *dev, u32 state); /* Device suspended */
|
||||
int (*resume) (struct pci_dev *dev); /* Device woken up */
|
||||
|
@ -266,7 +266,7 @@ struct usbdevfs_hub_portinfo
|
|||
#define KERN_WARNING "WRN: "
|
||||
#define KERN_INFO "INF: "
|
||||
#define GFP_KERNEL 0
|
||||
#define GFP_ATOMIC 0
|
||||
#define GFP_ATOMIC 0x20
|
||||
#define GFP_NOIO 0
|
||||
#define SLAB_ATOMIC 0
|
||||
#define PCI_ANY_ID (~0)
|
||||
|
@ -328,7 +328,7 @@ struct usbdevfs_hub_portinfo
|
|||
|
||||
#define inw(x) READ_PORT_USHORT((PUSHORT)(x))
|
||||
#define outw(x,p) WRITE_PORT_USHORT((PUSHORT)(p),(x))
|
||||
#define outl(x,p) WRITE_PORT_ULONG((PUSHORT)(p),(x))
|
||||
#define outl(x,p) WRITE_PORT_ULONG((PULONG)(p),(x))
|
||||
|
||||
/* The kernel macro for list_for_each_entry makes nonsense (have no clue
|
||||
* why, this is just the same definition...) */
|
||||
|
@ -479,8 +479,8 @@ int my_pci_module_init(struct pci_driver *x);
|
|||
#define PCI_DMA_FROMDEVICE
|
||||
#define PCI_DMA_TODEVICE
|
||||
|
||||
#define PCI_ROM_RESOURCE 0
|
||||
#define IORESOURCE_IO 1
|
||||
#define PCI_ROM_RESOURCE 1
|
||||
#define IORESOURCE_IO CM_RESOURCE_PORT_IO
|
||||
|
||||
#define DECLARE_WAITQUEUE(a,b) KEVENT a=0
|
||||
#define init_waitqueue_head(a) my_init_waitqueue_head(a)
|
||||
|
@ -757,7 +757,7 @@ static void __inline__ complete(struct completion *p)
|
|||
{
|
||||
/* Wake up x->wait */
|
||||
p->done++;
|
||||
wake_up(&p->wait);
|
||||
wake_up((PKEVENT)&p->wait);
|
||||
}
|
||||
|
||||
#define kernel_thread(a,b,c) my_kernel_thread(a,b,c)
|
||||
|
@ -799,4 +799,5 @@ void do_all_timers(void);
|
|||
|
||||
#define __KERNEL_DS 0x18
|
||||
|
||||
int my_pci_write_config_word(struct pci_dev *, int, u16);
|
||||
|
||||
|
|
|
@ -39,8 +39,12 @@ static unsigned long __inline__ pci_resource_len (struct pci_dev *dev, int x)
|
|||
// ???
|
||||
static int __inline__ pci_resource_flags(struct pci_dev *dev, int x)
|
||||
{
|
||||
DPRINT1("pci_resource_flags() called, x=0x%x\n");
|
||||
return dev->flags[x];
|
||||
POHCI_DEVICE_EXTENSION ext = (POHCI_DEVICE_EXTENSION)dev->dev_ext;
|
||||
|
||||
DPRINT1("pci_resource_flags() called, x=0x%x\n", x);
|
||||
|
||||
//FIXME: Take x into account
|
||||
return ext->Flags;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -79,8 +83,8 @@ name name of requester
|
|||
*/
|
||||
static int __inline__ request_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
|
||||
{
|
||||
DPRINT1("request_region(): addr=0x%x, len=0x%x\n", addr, len);
|
||||
return 0;
|
||||
DPRINT1("request_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -108,7 +112,7 @@ n length of region
|
|||
*/
|
||||
static int __inline__ release_region(PHYSICAL_ADDRESS addr, unsigned long len)
|
||||
{
|
||||
DPRINT1("release_region(): addr=0x%x, len=0x%x\n", addr, len);
|
||||
DPRINT1("release_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -122,7 +126,7 @@ name name of requester
|
|||
*/
|
||||
static int __inline__ request_mem_region(PHYSICAL_ADDRESS addr, unsigned long len, const char * d)
|
||||
{
|
||||
DPRINT1("request_mem_region(): addr=0x%x, len=0x%x\n", addr, len);
|
||||
DPRINT1("request_mem_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -139,7 +143,7 @@ virtual start address of mapped range
|
|||
static void __inline__ *ioremap_nocache(PHYSICAL_ADDRESS addr, unsigned long len)
|
||||
{
|
||||
// MmMapIoSpace with NoCache param
|
||||
DPRINT1("ioremap_nocache(): addr=0x%x, len=0x%x\n", addr, len);
|
||||
DPRINT1("ioremap_nocache(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
|
||||
|
||||
return MmMapIoSpace(addr, len, MmNonCached);
|
||||
}
|
||||
|
@ -153,6 +157,6 @@ n length of region
|
|||
*/
|
||||
static int __inline__ release_mem_region(PHYSICAL_ADDRESS addr, unsigned long len)
|
||||
{
|
||||
DPRINT1("release_mem_region(): addr=0x%x, len=0x%x\n", addr, len);
|
||||
DPRINT1("release_mem_region(): addr=0x%lx, len=0x%lx\n", addr.u.LowPart, len);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#define PCI_DEVICE_ID_NS_87560_LIO 0x000e
|
||||
#define PCI_DEVICE_ID_INTEL_82371AB_2 0x7112
|
||||
|
||||
#define PCI_CLASS_SERIAL_USB (PCI_CLASS_SERIAL_BUS_CTLR << 8 + PCI_SUBCLASS_SB_USB)
|
||||
#define PCI_CLASS_SERIAL_USB ((PCI_CLASS_SERIAL_BUS_CTLR << 8) + PCI_SUBCLASS_SB_USB)
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
O_TARGET := usbwrapper.o BootUSB.o linuxwrapper.o xpad.o xremote.o usbkey.o risefall.o
|
||||
|
||||
include $(TOPDIR)/Rules.make
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void init_wrapper(struct pci_dev *probe_dev)
|
|||
void handle_irqs(int irq)
|
||||
{
|
||||
int n;
|
||||
// printk("handle irqs\n");
|
||||
printk("handle irqs\n");
|
||||
for(n=0;n<MAX_IRQS;n++)
|
||||
{
|
||||
if (reg_irqs[n].handler && (irq==reg_irqs[n].irq || irq==-1))
|
||||
|
@ -100,7 +100,7 @@ void do_all_timers(void)
|
|||
main_timer_list[n]->expires=0;
|
||||
|
||||
main_timer_list[n]=NULL; // remove timer
|
||||
// printk("do timer %i fn %p\n",n,function);
|
||||
printk("do timer %i fn %p\n",n,function);
|
||||
|
||||
function(data);
|
||||
}
|
||||
|
@ -154,7 +154,8 @@ only link between usbcore and the registered device drivers! */
|
|||
int my_device_add(struct device *dev)
|
||||
{
|
||||
int n,found=0;
|
||||
// printk("drv_num %i %p %p\n",drvs_num,m_drivers[0]->probe,m_drivers[1]->probe);
|
||||
printk("drv_num %i %p %p\n",drvs_num,m_drivers[0]->probe,m_drivers[1]->probe);
|
||||
|
||||
if (dev->driver)
|
||||
{
|
||||
if (dev->driver->probe)
|
||||
|
@ -167,7 +168,8 @@ int my_device_add(struct device *dev)
|
|||
if (m_drivers[n]->probe)
|
||||
{
|
||||
dev->driver=m_drivers[n];
|
||||
// printk("probe%i %p ",n,m_drivers[n]->probe);
|
||||
printk("probe%i %p ",n,m_drivers[n]->probe);
|
||||
|
||||
if (m_drivers[n]->probe(dev) == 0)
|
||||
{
|
||||
// return 0;
|
||||
|
@ -186,7 +188,8 @@ int my_driver_register(struct device_driver *driver)
|
|||
|
||||
if (drvs_num<MAX_DRVS)
|
||||
{
|
||||
// printk("driver_register %i: %p %p",drvs_num,driver,driver->probe);
|
||||
printk("driver_register %i: %p %p",drvs_num,driver,driver->probe);
|
||||
|
||||
m_drivers[drvs_num++]=driver;
|
||||
return 0;
|
||||
}
|
||||
|
@ -228,7 +231,8 @@ int my_schedule_timeout(int x)
|
|||
{
|
||||
int wait=1;
|
||||
x+=10; // safety
|
||||
// printk("schedule_timeout %i\n",x);
|
||||
printk("schedule_timeout %i\n",x);
|
||||
|
||||
while(x>0)
|
||||
{
|
||||
do_all_timers();
|
||||
|
@ -243,14 +247,16 @@ int my_schedule_timeout(int x)
|
|||
x-=wait;
|
||||
}
|
||||
need_wakeup=0;
|
||||
// printk("schedule DONE!!!!!!\n");
|
||||
printk("schedule DONE!!!!!!\n");
|
||||
|
||||
return x;
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
void my_wait_for_completion(struct completion *x)
|
||||
{
|
||||
int n=100;
|
||||
// printk("wait for completion\n");
|
||||
printk("wait for completion\n");
|
||||
|
||||
while(!x->done && (n>0))
|
||||
{
|
||||
do_all_timers();
|
||||
|
@ -261,7 +267,8 @@ void my_wait_for_completion(struct completion *x)
|
|||
wait_ms(10);
|
||||
n--;
|
||||
}
|
||||
// printk("wait for completion done %i\n",x->done);
|
||||
printk("wait for completion done %i\n",x->done);
|
||||
|
||||
}
|
||||
/*------------------------------------------------------------------------*/
|
||||
void my_interruptible_sleep_on(PKEVENT evnt)
|
||||
|
@ -278,7 +285,7 @@ int my_pci_module_init(struct pci_driver *x)
|
|||
const struct pci_device_id *id=NULL;
|
||||
if (!pci_probe_dev)
|
||||
{
|
||||
printk(KERN_ERR "PCI device not set!\n");
|
||||
DPRINT1("PCI device not set!\n");
|
||||
return 0;
|
||||
}
|
||||
x->probe(dev, id);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* $Id: xremote.c,v 1.5 2004/11/22 19:10:57 davidmpye Exp $
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2002 Steven Toth <steve@toth.demon.co.uk>
|
||||
*
|
||||
|
|
|
@ -42,11 +42,15 @@
|
|||
#include <linux/interrupt.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/proc_fs.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB_DEBUG
|
||||
#define DEBUG
|
||||
#else
|
||||
#undef DEBUG
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#include <linux/usb.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
|
@ -79,9 +83,9 @@
|
|||
* debug = 3, show all TD's in URB's when dumping
|
||||
*/
|
||||
#ifdef DEBUG
|
||||
static int debug = 1;
|
||||
static int debug = 3;
|
||||
#else
|
||||
static int debug = 0;
|
||||
static int debug = 2;
|
||||
#endif
|
||||
MODULE_PARM(debug, "i");
|
||||
MODULE_PARM_DESC(debug, "Debug level");
|
||||
|
@ -1873,7 +1877,7 @@ static void uhci_remove_pending_qhs(struct uhci_hcd *uhci)
|
|||
spin_unlock_irqrestore(&uhci->urb_remove_list_lock, flags);
|
||||
}
|
||||
|
||||
static void uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
|
||||
static int uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
|
||||
{
|
||||
struct uhci_hcd *uhci = hcd_to_uhci(hcd);
|
||||
unsigned int io_addr = uhci->io_addr;
|
||||
|
@ -1886,7 +1890,7 @@ static void uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
|
|||
*/
|
||||
status = inw(io_addr + USBSTS);
|
||||
if (!status) /* shared interrupt, not mine */
|
||||
return;
|
||||
return 0;
|
||||
outw(status, io_addr + USBSTS); /* Clear it */
|
||||
|
||||
if (status & ~(USBSTS_USBINT | USBSTS_ERROR | USBSTS_RD)) {
|
||||
|
@ -1925,6 +1929,8 @@ static void uhci_irq(struct usb_hcd *hcd, struct pt_regs *regs)
|
|||
spin_unlock(&uhci->urb_list_lock);
|
||||
|
||||
uhci_finish_completion(hcd, regs);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void reset_hc(struct uhci_hcd *uhci)
|
||||
|
@ -2271,6 +2277,7 @@ static int __devinit uhci_start(struct usb_hcd *hcd)
|
|||
err("unable to allocate root hub");
|
||||
goto err_alloc_root_hub;
|
||||
}
|
||||
hcd->pdev->bus = (struct pci_bus *)udev; /* Fix bus pointer for initial device */
|
||||
|
||||
uhci->term_td = uhci_alloc_td(uhci, udev);
|
||||
if (!uhci->term_td) {
|
||||
|
@ -2484,7 +2491,7 @@ static int uhci_hcd_get_frame_number(struct usb_hcd *hcd)
|
|||
|
||||
static const char hcd_name[] = "uhci-hcd";
|
||||
|
||||
static const struct hc_driver uhci_driver = {
|
||||
static struct hc_driver uhci_driver = {
|
||||
.description = hcd_name,
|
||||
|
||||
/* Generic hardware linkage */
|
||||
|
|
|
@ -6,9 +6,14 @@
|
|||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <debug.h>
|
||||
#include "../linux/linux_wrapper.h"
|
||||
|
||||
// config and include core/hcd.h, for hc_device struct
|
||||
#include "../usb_wrapper.h"
|
||||
#include "../core/hcd.h"
|
||||
|
||||
#include "../host/ohci_main.h"
|
||||
|
||||
|
||||
// declare basic init funcs
|
||||
void init_wrapper(struct pci_dev *probe_dev);
|
||||
int uhci_hcd_init(void);
|
||||
|
@ -16,15 +21,13 @@ void uhci_hcd_cleanup(void);
|
|||
int STDCALL usb_init(void);
|
||||
void STDCALL usb_exit(void);
|
||||
extern struct pci_driver uhci_pci_driver;
|
||||
extern const struct pci_device_id uhci_pci_ids[];
|
||||
|
||||
extern struct pci_device_id uhci_pci_ids[];
|
||||
|
||||
|
||||
// This should be removed, but for testing purposes it's here
|
||||
struct pci_dev *dev;
|
||||
//struct pci_device_id *dev_id;
|
||||
|
||||
|
||||
#define USB_UHCI_TAG TAG('u','s','b','u')
|
||||
|
||||
NTSTATUS STDCALL AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT pdo)
|
||||
|
@ -133,7 +136,7 @@ NTSTATUS InitLinuxWrapper(PDEVICE_OBJECT DeviceObject)
|
|||
dev = ExAllocatePoolWithTag(PagedPool, sizeof(struct pci_dev), USB_UHCI_TAG);
|
||||
|
||||
init_wrapper(dev);
|
||||
dev->irq = DeviceExtension->InterruptLevel;
|
||||
dev->irq = DeviceExtension->InterruptVector;
|
||||
dev->dev_ext = (PVOID)DeviceExtension;
|
||||
dev->slot_name = ExAllocatePoolWithTag(NonPagedPool, 128, USB_UHCI_TAG); // 128 max len for slot name
|
||||
|
||||
|
@ -208,6 +211,9 @@ OHCD_PnPStartDevice(IN PDEVICE_OBJECT DeviceObject,
|
|||
FullList->BusNumber == DeviceExtension->SystemIoBusNumber &&
|
||||
1 == FullList->PartialResourceList.Version &&
|
||||
1 == FullList->PartialResourceList.Revision);*/
|
||||
DPRINT1("AllocRess->Count: %d, PartResList.Count: %d\n",
|
||||
AllocatedResources->Count, FullList->PartialResourceList.Count);
|
||||
|
||||
for (Descriptor = FullList->PartialResourceList.PartialDescriptors;
|
||||
Descriptor < FullList->PartialResourceList.PartialDescriptors + FullList->PartialResourceList.Count;
|
||||
Descriptor++)
|
||||
|
@ -216,18 +222,40 @@ OHCD_PnPStartDevice(IN PDEVICE_OBJECT DeviceObject,
|
|||
{
|
||||
DeviceExtension->InterruptLevel = Descriptor->u.Interrupt.Level;
|
||||
DeviceExtension->InterruptVector = Descriptor->u.Interrupt.Vector;
|
||||
|
||||
DPRINT1("Interrupt level: 0x%x Interrupt Vector: 0x%x\n",
|
||||
DeviceExtension->InterruptLevel,
|
||||
DeviceExtension->InterruptVector);
|
||||
}
|
||||
else if (Descriptor->Type == CmResourceTypePort)
|
||||
{
|
||||
DeviceExtension->BaseAddress = Descriptor->u.Port.Start;
|
||||
DeviceExtension->BaseAddrLength = Descriptor->u.Port.Length;
|
||||
DeviceExtension->Flags = Descriptor->Flags;
|
||||
|
||||
((struct hc_driver *)uhci_pci_ids->driver_data)->flags &= ~HCD_MEMORY;
|
||||
|
||||
DPRINT1("I/O resource: start=0x%x, length=0x%x\n",
|
||||
DeviceExtension->BaseAddress.u.LowPart, DeviceExtension->BaseAddrLength);
|
||||
}
|
||||
else if (Descriptor->Type == CmResourceTypeMemory)
|
||||
{
|
||||
DeviceExtension->BaseAddress = Descriptor->u.Memory.Start;
|
||||
DeviceExtension->BaseAddrLength = Descriptor->u.Memory.Length;
|
||||
DeviceExtension->Flags = Descriptor->Flags;
|
||||
|
||||
((struct hc_driver *)uhci_pci_ids->driver_data)->flags |= HCD_MEMORY;
|
||||
|
||||
DPRINT1("Memory resource: start=0x%x, length=0x%x\n",
|
||||
DeviceExtension->BaseAddress.u.LowPart, DeviceExtension->BaseAddrLength);
|
||||
}
|
||||
else
|
||||
DPRINT1("Get resource type: %d, Generic start=0x%x Generic length=0x%x\n",
|
||||
Descriptor->Type, Descriptor->u.Generic.Start.u.LowPart, Descriptor->u.Generic.Length);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
DPRINT1("Interrupt level: 0x%x Interrupt Vector: 0x%x\n",
|
||||
DeviceExtension->InterruptLevel,
|
||||
DeviceExtension->InterruptVector);
|
||||
|
||||
/*
|
||||
* Init wrapper with this object
|
||||
|
|
|
@ -13,3 +13,4 @@ void wait_ms(int mils);
|
|||
|
||||
#include "linux/usb.h"
|
||||
#include "linux/pci_ids.h"
|
||||
|
||||
|
|
|
@ -158,7 +158,6 @@ IntInitScreenInfo(
|
|||
ModeInfoPtr = ModeInfo;
|
||||
while (ModeCount-- > 0)
|
||||
{
|
||||
|
||||
if (ModeInfoPtr->Length > 0 &&
|
||||
pDevMode->dmPelsWidth == ModeInfoPtr->VisScreenWidth &&
|
||||
pDevMode->dmPelsHeight == ModeInfoPtr->VisScreenHeight &&
|
||||
|
@ -170,7 +169,8 @@ IntInitScreenInfo(
|
|||
break;
|
||||
}
|
||||
|
||||
ModeInfoPtr++;
|
||||
ModeInfoPtr = (PVIDEO_MODE_INFORMATION)
|
||||
(((PUCHAR)ModeInfoPtr) + ModeInfoSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -383,6 +383,7 @@ DrvGetModes(
|
|||
{
|
||||
if (ModeInfoPtr->Length == 0)
|
||||
{
|
||||
ModeInfoPtr = (PVIDEO_MODE_INFORMATION)(((ULONG_PTR)ModeInfoPtr) + ModeInfoSize);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -885,6 +885,14 @@ VBEQueryMode(
|
|||
VideoMode->YMillimeter = 0; /* FIXME */
|
||||
if (VBEMode->BitsPerPixel > 8)
|
||||
{
|
||||
/*
|
||||
* Always report 16bpp modes and not 15bpp mode...
|
||||
*/
|
||||
if (VBEMode->BitsPerPixel == 15 && VBEMode->NumberOfPlanes == 1)
|
||||
{
|
||||
VideoMode->BitsPerPlane = 16;
|
||||
}
|
||||
|
||||
if (DeviceExtension->VbeInfo.Version < 0x300)
|
||||
{
|
||||
VideoMode->NumberRedBits = VBEMode->RedMaskSize;
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include <ddk/ntapi.h>
|
||||
|
||||
#ifdef DBG
|
||||
#define DPRINT(arg) DbgPrint arg;
|
||||
#define DPRINT(arg) DbgPrint(arg)
|
||||
#else
|
||||
#define DPRINT(arg)
|
||||
#endif
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <apic.h>
|
||||
#include <ioapic.h>
|
||||
|
||||
//#define NDEBUG
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* GLOBALS ******************************************************************/
|
||||
|
@ -58,7 +58,7 @@ HaliMPIntSrcInfo(PMP_CONFIGURATION_INTSRC m)
|
|||
IRQCount++;
|
||||
}
|
||||
|
||||
static PCHAR
|
||||
PCHAR
|
||||
HaliMPFamily(ULONG Family,
|
||||
ULONG Model)
|
||||
{
|
||||
|
@ -277,7 +277,7 @@ HaliReadMPConfigTable(PMP_CONFIGURATION_TABLE Table)
|
|||
|
||||
DPRINT1("Bad MP configuration block signature: %c%c%c%c\n",
|
||||
pc[0], pc[1], pc[2], pc[3]);
|
||||
KEBUGCHECK(0);
|
||||
KEBUGCHECKEX(0, pc[0], pc[1], pc[2], pc[3]);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,43 @@ typedef NTSTATUS STDCALL_FUNC
|
|||
PSECURITY_DESCRIPTOR SecurityDescriptor,
|
||||
PULONG BufferLength);
|
||||
|
||||
typedef struct _OBJECT_HANDLE_COUNT_ENTRY
|
||||
{
|
||||
struct _EPROCESS *Process;
|
||||
ULONG HandleCount;
|
||||
} OBJECT_HANDLE_COUNT_ENTRY, *POBJECT_HANDLE_COUNT_ENTRY;
|
||||
|
||||
typedef struct _OBJECT_HANDLE_COUNT_DATABASE
|
||||
{
|
||||
ULONG CountEntries;
|
||||
POBJECT_HANDLE_COUNT_ENTRY HandleCountEntries[1];
|
||||
} OBJECT_HANDLE_COUNT_DATABASE, *POBJECT_HANDLE_COUNT_DATABASE;
|
||||
|
||||
typedef struct _OBJECT_HEADER_HANDLE_INFO
|
||||
{
|
||||
union {
|
||||
POBJECT_HANDLE_COUNT_DATABASE HandleCountDatabase;
|
||||
OBJECT_HANDLE_COUNT_ENTRY SingleEntry;
|
||||
};
|
||||
} OBJECT_HEADER_HANDLE_INFO, *POBJECT_HEADER_HANDLE_INFO;
|
||||
|
||||
typedef struct _OBJECT_HEADER_CREATOR_INFO
|
||||
{
|
||||
LIST_ENTRY TypeList;
|
||||
PVOID CreatorUniqueProcess;
|
||||
USHORT CreatorBackTraceIndex;
|
||||
USHORT Reserved;
|
||||
} OBJECT_HEADER_CREATOR_INFO, *POBJECT_HEADER_CREATOR_INFO;
|
||||
|
||||
typedef struct _OBJECT_HEADER_NAME_INFO
|
||||
{
|
||||
struct _DIRECTORY_OBJECT *Directory;
|
||||
UNICODE_STRING Name;
|
||||
ULONG QueryReferences;
|
||||
ULONG Reserved2;
|
||||
ULONG DbgReferenceCount;
|
||||
} OBJECT_HEADER_NAME_INFO, *POBJECT_HEADER_NAME_INFO;
|
||||
|
||||
typedef struct _OBJECT_CREATE_INFORMATION
|
||||
{
|
||||
ULONG Attributes;
|
||||
|
|
|
@ -48,11 +48,19 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* TODO: Make the output of file/line and the debug message atomic */
|
||||
#ifdef DBG
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ",__FILE__,__LINE__), DbgPrint
|
||||
#define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); } while(0);
|
||||
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define DPRINT1(args...)
|
||||
#define CHECKPOINT1
|
||||
#else
|
||||
#define DPRINT1
|
||||
#define CHECKPOINT1
|
||||
#endif /* __GNUC__ */
|
||||
#endif
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0);
|
||||
|
|
|
@ -29,12 +29,17 @@
|
|||
#define CHECKPOINT do { DbgPrint("(NTDLL:%s:%d) Checkpoint\n",__FILE__,__LINE__); } while(0)
|
||||
#endif
|
||||
|
||||
#ifdef DBG
|
||||
#if defined(__GNUC__)
|
||||
#define DPRINT1(args...) do { DbgPrint("(NTDLL:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0)
|
||||
#else
|
||||
#define DPRINT1 DbgPrint("(NTDLL:%s:%d) ",__FILE__,__LINE__); DbgPrint
|
||||
#endif
|
||||
#define CHECKPOINT1 do { DbgPrint("(NTDLL:%s:%d) Checkpoint\n",__FILE__,__LINE__); } while(0)
|
||||
#else
|
||||
#define DPRINT1(args...)
|
||||
#define CHECKPOINT1(args...)
|
||||
#endif
|
||||
|
||||
#define ROUNDUP(a,b) ((((a)+(b)-1)/(b))*(b))
|
||||
#define ROUNDDOWN(a,b) (((a)/(b))*(b))
|
||||
|
|
|
@ -326,7 +326,7 @@ typedef struct _SYSTEM_PERFORMANCE_INFORMATION {
|
|||
ULONG SystemCalls;
|
||||
} SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
|
||||
|
||||
#ifndef __USE_W32API
|
||||
/*#ifndef __USE_W32API*/
|
||||
|
||||
// SystemProcessThreadInfo (5)
|
||||
typedef struct _SYSTEM_THREAD_INFORMATION
|
||||
|
@ -391,7 +391,7 @@ typedef struct _SYSTEM_PROCESS_INFORMATION
|
|||
SYSTEM_THREAD_INFORMATION TH[1];
|
||||
} SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
|
||||
|
||||
#endif
|
||||
/*#endif */
|
||||
|
||||
// SystemModuleInformation (11)
|
||||
typedef struct _SYSTEM_MODULE_INFORMATION_ENTRY {
|
||||
|
|
|
@ -39,9 +39,13 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DBG
|
||||
#define DPRINT1 DbgPrint("(%s:%d) ",__FILE__,__LINE__), DbgPrint
|
||||
#define CHECKPOINT1 DbgPrint("%s:%d\n",__FILE__,__LINE__);
|
||||
|
||||
#else
|
||||
#define DPRINT1(args...)
|
||||
#define CHECKPOINT1(args...)
|
||||
#endif
|
||||
|
||||
#ifdef __NTOSKRNL__
|
||||
#define DPRINT_CHECKS
|
||||
|
|
|
@ -12,7 +12,11 @@
|
|||
|
||||
unsigned long DbgPrint(char *Format,...);
|
||||
|
||||
#ifdef DBG
|
||||
#define DPRINT1 DbgPrint("(%s:%d:%s) ",__FILE__,__LINE__,__FUNCTION__), DbgPrint
|
||||
#else
|
||||
#define DPRINT1(args...)
|
||||
#endif
|
||||
|
||||
#if !defined(DBG) || !defined(YDEBUG)
|
||||
#ifdef __GNUC__
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <setjmp.h>
|
||||
#include <windef.h>
|
||||
#include <excpt.h>
|
||||
#include <wine/port.h>
|
||||
|
||||
/* The following definitions allow using exceptions in Wine and Winelib code
|
||||
*
|
||||
|
@ -75,6 +76,10 @@
|
|||
|
||||
#else /* USE_COMPILER_EXCEPTIONS */
|
||||
|
||||
#ifndef __GNUC__
|
||||
#define __attribute__(x) /* nothing */
|
||||
#endif
|
||||
|
||||
#define __TRY \
|
||||
do { __WINE_FRAME __f; \
|
||||
int __first = 1; \
|
||||
|
@ -91,7 +96,7 @@
|
|||
__f.u.filter = (func); \
|
||||
__wine_push_frame( &__f.frame ); \
|
||||
if (sigsetjmp( __f.jmp, 1 )) { \
|
||||
const __WINE_FRAME * const __eptr WINE_UNUSED = &__f; \
|
||||
const __WINE_FRAME * const __eptr __attribute__((unused)) = &__f; \
|
||||
do {
|
||||
|
||||
#define __ENDTRY \
|
||||
|
@ -125,10 +130,7 @@ typedef void (CALLBACK *__WINE_FINALLY)(BOOL);
|
|||
#define GetExceptionInformation() (__eptr)
|
||||
#define GetExceptionCode() (__eptr->ExceptionRecord->ExceptionCode)
|
||||
|
||||
#if defined(AbnormalTermination) && defined(__REACTOS__)
|
||||
#undef AbnormalTermination
|
||||
#endif
|
||||
|
||||
#define AbnormalTermination() (!__normal)
|
||||
|
||||
typedef struct __tagWINE_FRAME
|
||||
|
@ -175,8 +177,6 @@ static inline EXCEPTION_REGISTRATION_RECORD *__wine_pop_frame( EXCEPTION_REGISTR
|
|||
{
|
||||
#if defined(__GNUC__) && defined(__i386__)
|
||||
__asm__ __volatile__(".byte 0x64\n\tmovl %0,(0)"
|
||||
//: : "r" (frame->Prev) : "memory" );
|
||||
//return frame->Prev;
|
||||
: : "r" (frame->prev) : "memory" );
|
||||
return frame->prev;
|
||||
|
||||
|
|
|
@ -23,6 +23,17 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
enum msidbFileAttributes {
|
||||
msidbFileAttributesReadOnly = 0x00000001,
|
||||
msidbFileAttributesHidden = 0x00000002,
|
||||
msidbFileAttributesSystem = 0x00000004,
|
||||
msidbFileAttributesVital = 0x00000200,
|
||||
msidbFileAttributesChecksum = 0x00000400,
|
||||
msidbFileAttributesPatchAdded = 0x00001000,
|
||||
msidbFileAttributesNoncompressed = 0x00002000,
|
||||
msidbFileAttributesCompressed = 0x00004000
|
||||
};
|
||||
|
||||
enum msidbDialogAttributes {
|
||||
msidbDialogAttributesVisible = 0x00000001,
|
||||
msidbDialogAttributesModal = 0x00000002,
|
||||
|
@ -103,6 +114,22 @@ enum msidbComponentAttributes
|
|||
msidbComponentAttributes64bit = 0x00000100
|
||||
};
|
||||
|
||||
enum msidbRegistryRoot
|
||||
{
|
||||
msidbRegistryRootClassesRoot = 0,
|
||||
msidbRegistryRootCurrentUser = 1,
|
||||
msidbRegistryRootLocalMachine = 2,
|
||||
msidbRegistryRootUsers = 3,
|
||||
};
|
||||
|
||||
enum msidbLocatorType
|
||||
{
|
||||
msidbLocatorTypeDirectory = 0x000,
|
||||
msidbLocatorTypeFileName = 0x001,
|
||||
msidbLocatorTypeRawValue = 0x002,
|
||||
msidbLocatorType64bit = 0x010,
|
||||
};
|
||||
|
||||
/*
|
||||
* Windows SDK braindamage alert
|
||||
*
|
||||
|
|
|
@ -669,6 +669,7 @@ LONG WINAPI AddTagToGroupOrderList(PCWSTR lpGroupName, DWORD dwUnknown2, DWO
|
|||
VOID WINAPI AssertFail(LPSTR, UINT, LPSTR);
|
||||
DWORD WINAPI CaptureAndConvertAnsiArg(PCSTR lpSrc, PWSTR *lpDst);
|
||||
DWORD WINAPI CaptureStringArg(PCWSTR lpSrc, PWSTR *lpDst);
|
||||
BOOL WINAPI ConcatenatePaths(LPWSTR, LPCWSTR, DWORD, LPDWORD);
|
||||
BOOL WINAPI DelayedMove(PCWSTR lpExistingFileName, PCWSTR lpNewFileName);
|
||||
BOOL WINAPI DoesUserHavePrivilege(PCWSTR lpPrivilegeName);
|
||||
PWSTR WINAPI DuplicateString(PCWSTR lpSrc);
|
||||
|
@ -681,6 +682,7 @@ void WINAPI InstallHinfSectionW( HWND hwnd, HINSTANCE handle, PCWSTR cmdline
|
|||
BOOL WINAPI IsUserAdmin(VOID);
|
||||
PWSTR WINAPI MultiByteToUnicode(PCSTR lpMultiByteStr, UINT uCodePage);
|
||||
VOID WINAPI MyFree(PVOID lpMem);
|
||||
PWSTR WINAPI MyGetFileTitle(PCWSTR);
|
||||
PVOID WINAPI MyMalloc(DWORD dwSize);
|
||||
PVOID WINAPI MyRealloc(PVOID lpSrc, DWORD dwSize);
|
||||
DWORD WINAPI OpenAndMapForRead(PCWSTR, PDWORD, PHANDLE, PHANDLE, PVOID *);
|
||||
|
|
|
@ -3,6 +3,7 @@ TOPOBJDIR = ../..
|
|||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = cabinet.dll
|
||||
IMPORTLIB = libcabinet.$(IMPLIBEXT)
|
||||
IMPORTS = kernel32
|
||||
|
||||
C_SRCS = \
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* cabinet.h
|
||||
*
|
||||
* Copyright 2002 Greg Turner
|
||||
* Copyright 2005 Gerold Jens Wucherpfennig
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -292,6 +293,19 @@ typedef struct cds_forward {
|
|||
|
||||
typedef struct {
|
||||
unsigned int FCI_Intmagic;
|
||||
PERF perf;
|
||||
PFNFCIFILEPLACED pfnfiledest;
|
||||
PFNFCIALLOC pfnalloc;
|
||||
PFNFCIFREE pfnfree;
|
||||
PFNFCIOPEN pfnopen;
|
||||
PFNFCIREAD pfnread;
|
||||
PFNFCIWRITE pfnwrite;
|
||||
PFNFCICLOSE pfnclose;
|
||||
PFNFCISEEK pfnseek;
|
||||
PFNFCIDELETE pfndelete;
|
||||
PFNFCIGETTEMPFILE pfnfcigtf;
|
||||
PCCAB pccab;
|
||||
void *pv;
|
||||
} FCI_Int, *PFCI_Int;
|
||||
|
||||
typedef struct {
|
||||
|
@ -307,7 +321,7 @@ typedef struct {
|
|||
} FDI_Int, *PFDI_Int;
|
||||
|
||||
/* cast an HFCI into a PFCI_Int */
|
||||
#define PFCI_INT(hfci) ((PFDI_Int)(hfci))
|
||||
#define PFCI_INT(hfci) ((PFCI_Int)(hfci))
|
||||
|
||||
/* cast an HFDI into a PFDI_Int */
|
||||
#define PFDI_INT(hfdi) ((PFDI_Int)(hfdi))
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* File Compression Interface
|
||||
*
|
||||
* Copyright 2002 Patrik Stridvall
|
||||
* Copyright 2005 Gerold Jens Wucherpfennig
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -26,6 +27,7 @@
|
|||
#include "winbase.h"
|
||||
#include "winerror.h"
|
||||
#include "fci.h"
|
||||
#include "cabinet.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
|
@ -33,12 +35,55 @@ WINE_DEFAULT_DEBUG_CHANNEL(cabinet);
|
|||
|
||||
/***********************************************************************
|
||||
* FCICreate (CABINET.10)
|
||||
*
|
||||
* Provided with several callbacks,
|
||||
* returns a handle which can be used to perform operations
|
||||
* on cabinet files.
|
||||
*
|
||||
* PARAMS
|
||||
* perf [IO] A pointer to an ERF structure. When FCICreate
|
||||
* returns an error condition, error information may
|
||||
* be found here as well as from GetLastError.
|
||||
* pfnfiledest [I] A pointer to a function which is called when a file
|
||||
* is placed. Only useful for subsequent cabinet files.
|
||||
* pfnalloc [I] A pointer to a function which allocates ram. Uses
|
||||
* the same interface as malloc.
|
||||
* pfnfree [I] A pointer to a function which frees ram. Uses the
|
||||
* same interface as free.
|
||||
* pfnopen [I] A pointer to a function which opens a file. Uses
|
||||
* the same interface as _open.
|
||||
* pfnread [I] A pointer to a function which reads from a file into
|
||||
* a caller-provided buffer. Uses the same interface
|
||||
* as _read
|
||||
* pfnwrite [I] A pointer to a function which writes to a file from
|
||||
* a caller-provided buffer. Uses the same interface
|
||||
* as _write.
|
||||
* pfnclose [I] A pointer to a function which closes a file handle.
|
||||
* Uses the same interface as _close.
|
||||
* pfnseek [I] A pointer to a function which seeks in a file.
|
||||
* Uses the same interface as _lseek.
|
||||
* pfndelete [I] A pointer to a function which deletes a file.
|
||||
* pfnfcigtf [I] A pointer to a function which gets the name of a
|
||||
* temporary file; ignored in wine
|
||||
* pccab [I] A pointer to an initialized CCAB structure
|
||||
* pv [I] A pointer to an application-defined notification
|
||||
* function which will be passed to other FCI functions
|
||||
* as a parameter.
|
||||
*
|
||||
* RETURNS
|
||||
* On success, returns an FCI handle of type HFCI.
|
||||
* On failure, the NULL file handle is returned. Error
|
||||
* info can be retrieved from perf.
|
||||
*
|
||||
* INCLUDES
|
||||
* fci.h
|
||||
*
|
||||
*/
|
||||
HFCI __cdecl FCICreate(
|
||||
PERF perf,
|
||||
PFNFCIFILEPLACED pfnfcifp,
|
||||
PFNFCIALLOC pfna,
|
||||
PFNFCIFREE pfnf,
|
||||
PFNFCIFILEPLACED pfnfiledest,
|
||||
PFNFCIALLOC pfnalloc,
|
||||
PFNFCIFREE pfnfree,
|
||||
PFNFCIOPEN pfnopen,
|
||||
PFNFCIREAD pfnread,
|
||||
PFNFCIWRITE pfnwrite,
|
||||
|
@ -49,8 +94,47 @@ HFCI __cdecl FCICreate(
|
|||
PCCAB pccab,
|
||||
void *pv)
|
||||
{
|
||||
HFCI rv;
|
||||
|
||||
if ((!pfnalloc) || (!pfnfree)) {
|
||||
perf->erfOper = FCIERR_NONE;
|
||||
perf->erfType = ERROR_BAD_ARGUMENTS;
|
||||
perf->fError = TRUE;
|
||||
|
||||
SetLastError(ERROR_BAD_ARGUMENTS);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(rv = (HFCI) (*pfnalloc)(sizeof(FCI_Int)))) {
|
||||
perf->erfOper = FCIERR_ALLOC_FAIL;
|
||||
perf->erfType = ERROR_NOT_ENOUGH_MEMORY;
|
||||
perf->fError = TRUE;
|
||||
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PFCI_INT(rv)->FCI_Intmagic = FCI_INT_MAGIC;
|
||||
PFCI_INT(rv)->perf = perf;
|
||||
PFCI_INT(rv)->pfnfiledest = pfnfiledest;
|
||||
PFCI_INT(rv)->pfnalloc = pfnalloc;
|
||||
PFCI_INT(rv)->pfnfree = pfnfree;
|
||||
PFCI_INT(rv)->pfnopen = pfnopen;
|
||||
PFCI_INT(rv)->pfnread = pfnread;
|
||||
PFCI_INT(rv)->pfnwrite = pfnwrite;
|
||||
PFCI_INT(rv)->pfnclose = pfnclose;
|
||||
PFCI_INT(rv)->pfnseek = pfnseek;
|
||||
PFCI_INT(rv)->pfndelete = pfndelete;
|
||||
PFCI_INT(rv)->pfnfcigtf = pfnfcigtf;
|
||||
PFCI_INT(rv)->pccab = pccab;
|
||||
PFCI_INT(rv)->pv = pv;
|
||||
|
||||
/* Still mark as incomplete, because of other missing FCI* APIs */
|
||||
|
||||
PFCI_INT(rv)->FCI_Intmagic = 0;
|
||||
PFDI_FREE(rv, rv);
|
||||
FIXME("(%p, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p, %p): stub\n",
|
||||
perf, pfnfcifp, pfna, pfnf, pfnopen, pfnread, pfnwrite, pfnclose,
|
||||
perf, pfnfiledest, pfnalloc, pfnfree, pfnopen, pfnread, pfnwrite, pfnclose,
|
||||
pfnseek, pfndelete, pfnfcigtf, pccab, pv);
|
||||
|
||||
perf->erfOper = FCIERR_NONE;
|
||||
|
@ -60,6 +144,7 @@ HFCI __cdecl FCICreate(
|
|||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -116,12 +201,30 @@ BOOL __cdecl FCIFlushFolder(
|
|||
|
||||
/***********************************************************************
|
||||
* FCIDestroy (CABINET.14)
|
||||
*
|
||||
* Frees a handle created by FCICreate.
|
||||
* Only reason for failure would be an invalid handle.
|
||||
*
|
||||
* PARAMS
|
||||
* hfci [I] The HFCI to free
|
||||
*
|
||||
* RETURNS
|
||||
* TRUE for success
|
||||
* FALSE for failure
|
||||
*/
|
||||
BOOL __cdecl FCIDestroy(HFCI hfci)
|
||||
{
|
||||
if (REALLY_IS_FCI(hfci)) {
|
||||
PFCI_INT(hfci)->FCI_Intmagic = 0;
|
||||
PFDI_FREE(hfci, hfci);
|
||||
/*return TRUE; */
|
||||
} else {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Still mark as incomplete, because of other missing FCI* APIs */
|
||||
FIXME("(%p): stub\n", hfci);
|
||||
|
||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ TOPOBJDIR = ../..
|
|||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = comctl32.dll
|
||||
IMPORTLIB = libcomctl32.$(IMPLIBEXT)
|
||||
IMPORTS = user32 gdi32 advapi32 kernel32
|
||||
DELAYIMPORTS = winmm
|
||||
EXTRALIBS = $(LIBUNICODE)
|
||||
|
|
|
@ -283,6 +283,26 @@ static void COMBOEX_FreeText (CBE_ITEMDATA *item)
|
|||
}
|
||||
|
||||
|
||||
static INT COMBOEX_GetIndex(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
|
||||
{
|
||||
CBE_ITEMDATA *moving;
|
||||
INT index;
|
||||
|
||||
moving = infoPtr->items;
|
||||
index = infoPtr->nb_items - 1;
|
||||
|
||||
while (moving && (moving != item)) {
|
||||
moving = moving->next;
|
||||
index--;
|
||||
}
|
||||
if (!moving || (index < 0)) {
|
||||
ERR("COMBOBOXEX item structures broken. Please report!\n");
|
||||
return -1;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
static LPCWSTR COMBOEX_GetText(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
|
||||
{
|
||||
NMCOMBOBOXEXW nmce;
|
||||
|
@ -295,6 +315,7 @@ static LPCWSTR COMBOEX_GetText(COMBOEX_INFO *infoPtr, CBE_ITEMDATA *item)
|
|||
ZeroMemory(&nmce, sizeof(nmce));
|
||||
nmce.ceItem.mask = CBEIF_TEXT;
|
||||
nmce.ceItem.lParam = item->lParam;
|
||||
nmce.ceItem.iItem = COMBOEX_GetIndex(infoPtr, item);
|
||||
COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);
|
||||
|
||||
if (is_textW(nmce.ceItem.pszText)) {
|
||||
|
@ -1389,6 +1410,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
|
|||
ZeroMemory(&nmce, sizeof(nmce));
|
||||
nmce.ceItem.mask = CBEIF_INDENT;
|
||||
nmce.ceItem.lParam = item->lParam;
|
||||
nmce.ceItem.iItem = dis->itemID;
|
||||
COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);
|
||||
if (nmce.ceItem.mask & CBEIF_DI_SETITEM)
|
||||
item->iIndent = nmce.ceItem.iIndent;
|
||||
|
@ -1453,6 +1475,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
|
|||
ZeroMemory(&nmce, sizeof(nmce));
|
||||
nmce.ceItem.mask = (drawstate == ILD_NORMAL) ? CBEIF_IMAGE : CBEIF_SELECTEDIMAGE;
|
||||
nmce.ceItem.lParam = item->lParam;
|
||||
nmce.ceItem.iItem = dis->itemID;
|
||||
COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);
|
||||
if (drawstate == ILD_NORMAL) {
|
||||
if (nmce.ceItem.mask & CBEIF_DI_SETITEM) item->iImage = nmce.ceItem.iImage;
|
||||
|
@ -1468,6 +1491,7 @@ static LRESULT COMBOEX_DrawItem (COMBOEX_INFO *infoPtr, DRAWITEMSTRUCT *dis)
|
|||
ZeroMemory(&nmce, sizeof(nmce));
|
||||
nmce.ceItem.mask = CBEIF_OVERLAY;
|
||||
nmce.ceItem.lParam = item->lParam;
|
||||
nmce.ceItem.iItem = dis->itemID;
|
||||
COMBOEX_NotifyItem(infoPtr, CBEN_GETDISPINFOW, &nmce);
|
||||
if (nmce.ceItem.mask & CBEIF_DI_SETITEM)
|
||||
item->iOverlay = nmce.ceItem.iOverlay;
|
||||
|
|
|
@ -588,7 +588,7 @@ static void MRU_SaveChanged ( LPWINEMRULIST mp )
|
|||
if ((err = RegOpenKeyExW( mp->extview.hKey, mp->extview.lpszSubKey,
|
||||
0, KEY_WRITE, &newkey))) {
|
||||
/* not present - what to do ??? */
|
||||
ERR("Can not open key, error=%d, attempting to create\n",
|
||||
ERR("Could not open key, error=%d, attempting to create\n",
|
||||
err);
|
||||
if ((err = RegCreateKeyExW( mp->extview.hKey, mp->extview.lpszSubKey,
|
||||
0,
|
||||
|
@ -980,7 +980,7 @@ static HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp)
|
|||
&newkey,
|
||||
&dwdisp))) {
|
||||
/* error - what to do ??? */
|
||||
ERR("(%lu %lu %lx %lx \"%s\" %p): Can not open key, error=%d\n",
|
||||
ERR("(%lu %lu %lx %lx \"%s\" %p): Could not open key, error=%d\n",
|
||||
mp->extview.cbSize, mp->extview.nMaxItems, mp->extview.dwFlags,
|
||||
(DWORD)mp->extview.hKey, debugstr_w(mp->extview.lpszSubKey),
|
||||
mp->extview.lpfnCompare, err);
|
||||
|
|
|
@ -607,7 +607,7 @@ DATETIME_Refresh (DATETIME_INFO *infoPtr, HDC hdc)
|
|||
RECT *checkbox = &infoPtr->checkbox;
|
||||
SIZE size;
|
||||
COLORREF oldTextColor;
|
||||
SHORT fieldWidth;
|
||||
SHORT fieldWidth = 0;
|
||||
|
||||
/* draw control edge */
|
||||
TRACE("\n");
|
||||
|
|
|
@ -163,7 +163,7 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
|
|||
HEADER_INFO *infoPtr = HEADER_GetInfoPtr (hwnd);
|
||||
HEADER_ITEM *phdi = &infoPtr->items[iItem];
|
||||
RECT r;
|
||||
INT oldBkMode;
|
||||
INT oldBkMode, cxEdge = GetSystemMetrics(SM_CXEDGE);
|
||||
|
||||
TRACE("DrawItem(iItem %d bHotTrack %d unicode flag %d)\n", iItem, bHotTrack, infoPtr->bUnicode);
|
||||
|
||||
|
@ -188,6 +188,9 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
|
|||
else
|
||||
DrawEdge (hdc, &r, EDGE_ETCHED, BF_BOTTOM | BF_RIGHT | BF_ADJUST);
|
||||
|
||||
r.left -= cxEdge;
|
||||
r.right += cxEdge;
|
||||
|
||||
if (phdi->fmt & HDF_OWNERDRAW) {
|
||||
DRAWITEMSTRUCT dis;
|
||||
dis.CtlType = ODT_HEADER;
|
||||
|
@ -206,137 +209,105 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
|
|||
SetBkMode(hdc, oldBkMode);
|
||||
}
|
||||
else {
|
||||
UINT uTextJustify = DT_LEFT;
|
||||
|
||||
if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_CENTER)
|
||||
uTextJustify = DT_CENTER;
|
||||
else if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_RIGHT)
|
||||
uTextJustify = DT_RIGHT;
|
||||
|
||||
if ((phdi->fmt & HDF_BITMAP) && !(phdi->fmt & HDF_BITMAP_ON_RIGHT) && (phdi->hbm)) {
|
||||
UINT rw, rh, /* width and height of r */
|
||||
*x = NULL, *w = NULL; /* x and width of the pic (bmp or img) which is part of cnt */
|
||||
/* cnt,txt,img,bmp */
|
||||
UINT cx, tx, ix, bx,
|
||||
cw, tw, iw, bw;
|
||||
BITMAP bmp;
|
||||
HDC hdcBitmap;
|
||||
INT yD, yS, cx, cy, rx, ry;
|
||||
|
||||
GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);
|
||||
cw = tw = iw = bw = 0;
|
||||
rw = r.right - r.left;
|
||||
rh = r.bottom - r.top;
|
||||
|
||||
ry = r.bottom - r.top;
|
||||
rx = r.right - r.left;
|
||||
|
||||
if (ry >= bmp.bmHeight) {
|
||||
cy = bmp.bmHeight;
|
||||
yD = r.top + (ry - bmp.bmHeight) / 2;
|
||||
yS = 0;
|
||||
}
|
||||
else {
|
||||
cy = ry;
|
||||
yD = r.top;
|
||||
yS = (bmp.bmHeight - ry) / 2;
|
||||
|
||||
}
|
||||
|
||||
if (rx >= bmp.bmWidth + infoPtr->iMargin) {
|
||||
cx = bmp.bmWidth;
|
||||
}
|
||||
else {
|
||||
cx = rx - infoPtr->iMargin;
|
||||
}
|
||||
|
||||
hdcBitmap = CreateCompatibleDC (hdc);
|
||||
SelectObject (hdcBitmap, phdi->hbm);
|
||||
BitBlt (hdc, r.left + infoPtr->iMargin, yD, cx, cy, hdcBitmap, 0, yS, SRCCOPY);
|
||||
DeleteDC (hdcBitmap);
|
||||
|
||||
r.left += (bmp.bmWidth + infoPtr->iMargin);
|
||||
}
|
||||
|
||||
|
||||
if ((phdi->fmt & HDF_BITMAP) && (phdi->fmt & HDF_BITMAP_ON_RIGHT) && (phdi->hbm)) {
|
||||
BITMAP bmp;
|
||||
HDC hdcBitmap;
|
||||
INT xD, yD, yS, cx, cy, rx, ry, tx;
|
||||
if (phdi->fmt & HDF_STRING) {
|
||||
RECT textRect;
|
||||
|
||||
GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);
|
||||
|
||||
textRect = r;
|
||||
if (phdi->fmt & HDF_STRING) {
|
||||
DrawTextW (hdc, phdi->pszText, -1,
|
||||
&textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);
|
||||
tx = textRect.right - textRect.left;
|
||||
cw = textRect.right - textRect.left + 2 * infoPtr->iMargin;
|
||||
}
|
||||
|
||||
if ((phdi->fmt & HDF_IMAGE) && (infoPtr->himl)) {
|
||||
iw = infoPtr->himl->cx + 2 * infoPtr->iMargin;
|
||||
x = &ix;
|
||||
w = &iw;
|
||||
}
|
||||
|
||||
if ((phdi->fmt & HDF_BITMAP) && (phdi->hbm)) {
|
||||
GetObjectW (phdi->hbm, sizeof(BITMAP), (LPVOID)&bmp);
|
||||
bw = bmp.bmWidth + 2 * infoPtr->iMargin;
|
||||
if (!iw) {
|
||||
x = &bx;
|
||||
w = &bw;
|
||||
}
|
||||
}
|
||||
|
||||
if (bw || iw)
|
||||
cw += *w;
|
||||
|
||||
/* align cx using the unclipped cw */
|
||||
if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_LEFT)
|
||||
cx = r.left;
|
||||
else if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_CENTER)
|
||||
cx = r.left + rw / 2 - cw / 2;
|
||||
else /* HDF_RIGHT */
|
||||
cx = r.right - cw;
|
||||
|
||||
/* clip cx & cw */
|
||||
if (cx < r.left)
|
||||
cx = r.left;
|
||||
if (cx + cw > r.right)
|
||||
cw = r.right - cx;
|
||||
|
||||
tx = cx + infoPtr->iMargin;
|
||||
/* since cw might have changed we have to recalculate tw */
|
||||
tw = cw - infoPtr->iMargin * 2;
|
||||
|
||||
if (iw || bw) {
|
||||
tw -= *w;
|
||||
if (phdi->fmt & HDF_BITMAP_ON_RIGHT) {
|
||||
/* put pic behind text */
|
||||
*x = cx + tw + infoPtr->iMargin * 3;
|
||||
} else {
|
||||
*x = cx + infoPtr->iMargin;
|
||||
/* move text behind pic */
|
||||
tx += *w;
|
||||
}
|
||||
}
|
||||
|
||||
if (iw && bw) {
|
||||
/* since we're done with the layout we can
|
||||
now calculate the position of bmp which
|
||||
has no influence on alignment and layout
|
||||
because of img */
|
||||
if ((phdi->fmt & HDF_JUSTIFYMASK) == HDF_RIGHT)
|
||||
bx = cx - bw + infoPtr->iMargin;
|
||||
else
|
||||
tx = 0;
|
||||
ry = r.bottom - r.top;
|
||||
rx = r.right - r.left;
|
||||
|
||||
if (ry >= bmp.bmHeight) {
|
||||
cy = bmp.bmHeight;
|
||||
yD = r.top + (ry - bmp.bmHeight) / 2;
|
||||
yS = 0;
|
||||
}
|
||||
else {
|
||||
cy = ry;
|
||||
yD = r.top;
|
||||
yS = (bmp.bmHeight - ry) / 2;
|
||||
|
||||
bx = cx + cw + infoPtr->iMargin;
|
||||
}
|
||||
|
||||
if (r.left + tx + bmp.bmWidth + 2*infoPtr->iMargin <= r.right) {
|
||||
cx = bmp.bmWidth;
|
||||
xD = r.left + tx + infoPtr->iMargin;
|
||||
}
|
||||
else {
|
||||
if (rx >= bmp.bmWidth + infoPtr->iMargin ) {
|
||||
cx = bmp.bmWidth;
|
||||
xD = r.right - bmp.bmWidth - infoPtr->iMargin;
|
||||
r.right = xD - infoPtr->iMargin;
|
||||
}
|
||||
else {
|
||||
cx = rx - infoPtr->iMargin;
|
||||
xD = r.left;
|
||||
r.right = r.left;
|
||||
}
|
||||
}
|
||||
if (iw || bw) {
|
||||
HDC hClipDC = GetDC(hwnd);
|
||||
HRGN hClipRgn = CreateRectRgn(r.left, r.top, r.right, r.bottom);
|
||||
SelectClipRgn(hClipDC, hClipRgn);
|
||||
|
||||
hdcBitmap = CreateCompatibleDC (hdc);
|
||||
if (bw) {
|
||||
HDC hdcBitmap = CreateCompatibleDC (hClipDC);
|
||||
SelectObject (hdcBitmap, phdi->hbm);
|
||||
BitBlt (hdc, xD, yD, cx, cy, hdcBitmap, 0, yS, SRCCOPY);
|
||||
BitBlt (hClipDC, bx, r.top + ((INT)rh - bmp.bmHeight) / 2,
|
||||
bmp.bmWidth, bmp.bmHeight, hdcBitmap, 0, 0, SRCCOPY);
|
||||
DeleteDC (hdcBitmap);
|
||||
}
|
||||
|
||||
if ((phdi->fmt & HDF_IMAGE) && !(phdi->fmt & HDF_BITMAP_ON_RIGHT) && (infoPtr->himl)) {
|
||||
r.left += infoPtr->iMargin;
|
||||
ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, r.left, r.top + (r.bottom-r.top- infoPtr->himl->cy)/2,
|
||||
infoPtr->himl->cx, r.bottom-r.top, CLR_DEFAULT, CLR_DEFAULT, 0);
|
||||
r.left += infoPtr->himl->cx;
|
||||
if (iw) {
|
||||
ImageList_DrawEx (infoPtr->himl, phdi->iImage, hClipDC,
|
||||
ix, r.top + ((INT)rh - infoPtr->himl->cy) / 2,
|
||||
infoPtr->himl->cx, infoPtr->himl->cy, CLR_DEFAULT, CLR_DEFAULT, 0);
|
||||
}
|
||||
|
||||
if ((phdi->fmt & HDF_IMAGE) && (phdi->fmt & HDF_BITMAP_ON_RIGHT) && (infoPtr->himl)) {
|
||||
RECT textRect;
|
||||
INT tx;
|
||||
|
||||
textRect = r;
|
||||
if (phdi->fmt & HDF_STRING) {
|
||||
DrawTextW (hdc, phdi->pszText, -1,
|
||||
&textRect, DT_LEFT|DT_VCENTER|DT_SINGLELINE|DT_CALCRECT);
|
||||
tx = textRect.right - textRect.left;
|
||||
}
|
||||
else
|
||||
tx = 0;
|
||||
|
||||
if (tx < (r.right-r.left - infoPtr->himl->cx - GetSystemMetrics(SM_CXEDGE)))
|
||||
ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, r.left + tx + 2*infoPtr->iMargin,
|
||||
r.top + (r.bottom-r.top-infoPtr->himl->cy)/2, infoPtr->himl->cx, r.bottom-r.top,
|
||||
CLR_DEFAULT, CLR_DEFAULT, 0);
|
||||
else {
|
||||
INT x = max(r.right - infoPtr->iMargin - infoPtr->himl->cx, r.left);
|
||||
INT cx = min(infoPtr->himl->cx, r.right-r.left - GetSystemMetrics(SM_CXEDGE));
|
||||
ImageList_DrawEx(infoPtr->himl, phdi->iImage, hdc, x ,
|
||||
r.top + (r.bottom-r.top-infoPtr->himl->cy)/2, cx, r.bottom-r.top,
|
||||
CLR_DEFAULT, CLR_DEFAULT, 0);
|
||||
r.right -= infoPtr->himl->cx - infoPtr->iMargin;
|
||||
}
|
||||
DeleteObject(hClipRgn);
|
||||
DeleteDC(hClipDC);
|
||||
}
|
||||
|
||||
if (((phdi->fmt & HDF_STRING)
|
||||
|
@ -344,11 +315,11 @@ HEADER_DrawItem (HWND hwnd, HDC hdc, INT iItem, BOOL bHotTrack)
|
|||
HDF_BITMAP_ON_RIGHT|HDF_IMAGE)))) /* no explicit format specified? */
|
||||
&& (phdi->pszText)) {
|
||||
oldBkMode = SetBkMode(hdc, TRANSPARENT);
|
||||
r.left += infoPtr->iMargin;
|
||||
r.right -= infoPtr->iMargin;
|
||||
SetTextColor (hdc, (bHotTrack) ? COLOR_HIGHLIGHT : COLOR_BTNTEXT);
|
||||
r.left = tx;
|
||||
r.right = tx + tw;
|
||||
DrawTextW (hdc, phdi->pszText, -1,
|
||||
&r, uTextJustify|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);
|
||||
&r, DT_LEFT|DT_END_ELLIPSIS|DT_VCENTER|DT_SINGLELINE);
|
||||
if (oldBkMode != TRANSPARENT)
|
||||
SetBkMode(hdc, oldBkMode);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ typedef struct tagHOTKEY_INFO
|
|||
BYTE CurrMod;
|
||||
INT CaretPos;
|
||||
DWORD ScanCode;
|
||||
WCHAR strNone[15]; /* hope its long enough ... */
|
||||
WCHAR strNone[15]; /* hope it's long enough ... */
|
||||
} HOTKEY_INFO;
|
||||
|
||||
static const WCHAR HOTKEY_plussep[] = { ' ', '+', ' ' };
|
||||
|
|
|
@ -98,7 +98,7 @@ static inline BOOL is_valid(HIMAGELIST himl)
|
|||
* nothing
|
||||
*
|
||||
* NOTES
|
||||
* This function can NOT be used to reduce the number of images.
|
||||
* This function CANNOT be used to reduce the number of images.
|
||||
*/
|
||||
static void
|
||||
IMAGELIST_InternalExpandBitmaps (HIMAGELIST himl, INT nImageCount, INT cx, INT cy)
|
||||
|
|
|
@ -62,6 +62,7 @@ typedef struct
|
|||
{
|
||||
HWND Self;
|
||||
HWND Notify;
|
||||
BOOL Enabled;
|
||||
IPPART_INFO Part[4];
|
||||
} IPADDRESS_INFO;
|
||||
|
||||
|
@ -127,13 +128,27 @@ static LRESULT IPADDRESS_Draw (IPADDRESS_INFO *infoPtr, HDC hdc)
|
|||
static const WCHAR dotW[] = { '.', 0 };
|
||||
RECT rect, rcPart;
|
||||
POINT pt;
|
||||
COLORREF bgCol, fgCol;
|
||||
int i;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
GetClientRect (infoPtr->Self, &rect);
|
||||
|
||||
if (infoPtr->Enabled) {
|
||||
bgCol = COLOR_WINDOW;
|
||||
fgCol = COLOR_WINDOWTEXT;
|
||||
} else {
|
||||
bgCol = COLOR_3DFACE;
|
||||
fgCol = COLOR_GRAYTEXT;
|
||||
}
|
||||
|
||||
FillRect (hdc, &rect, (HBRUSH) (bgCol+1));
|
||||
DrawEdge (hdc, &rect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
|
||||
|
||||
SetBkColor (hdc, GetSysColor(bgCol));
|
||||
SetTextColor(hdc, GetSysColor(fgCol));
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
GetWindowRect (infoPtr->Part[i].EditHwnd, &rcPart);
|
||||
pt.x = rcPart.right;
|
||||
|
@ -174,6 +189,7 @@ static LRESULT IPADDRESS_Create (HWND hwnd, LPCREATESTRUCTA lpCreate)
|
|||
edit.bottom = rcClient.bottom - 2;
|
||||
|
||||
infoPtr->Self = hwnd;
|
||||
infoPtr->Enabled = FALSE;
|
||||
infoPtr->Notify = lpCreate->hwndParent;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
|
@ -215,6 +231,20 @@ static LRESULT IPADDRESS_Destroy (IPADDRESS_INFO *infoPtr)
|
|||
}
|
||||
|
||||
|
||||
static LRESULT IPADDRESS_Enable (IPADDRESS_INFO *infoPtr, BOOL enabled)
|
||||
{
|
||||
int i;
|
||||
|
||||
infoPtr->Enabled = enabled;
|
||||
|
||||
for (i = 0; i < 4; i++)
|
||||
EnableWindow(infoPtr->Part[i].EditHwnd, enabled);
|
||||
|
||||
InvalidateRgn(infoPtr->Self, NULL, FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static LRESULT IPADDRESS_Paint (IPADDRESS_INFO *infoPtr, HDC hdc)
|
||||
{
|
||||
PAINTSTRUCT ps;
|
||||
|
@ -517,6 +547,10 @@ IPADDRESS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_DESTROY:
|
||||
return IPADDRESS_Destroy (infoPtr);
|
||||
|
||||
case WM_ENABLE:
|
||||
return IPADDRESS_Enable (infoPtr, (BOOL)wParam);
|
||||
break;
|
||||
|
||||
case WM_PAINT:
|
||||
return IPADDRESS_Paint (infoPtr, (HDC)wParam);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* NOTES
|
||||
*
|
||||
* This code was audited for completeness against the documented features
|
||||
* of Comctl32.dll version 6.0 on Oct. 21, 2002, by Dimitrie O. Paun.
|
||||
* of Comctl32.dll version 6.0 on May. 20, 2005, by James Hawkins.
|
||||
*
|
||||
* Unless otherwise noted, we believe this code to be complete, as per
|
||||
* the specification mentioned above.
|
||||
|
@ -32,6 +32,17 @@
|
|||
*
|
||||
* TODO:
|
||||
*
|
||||
* Default Message Processing
|
||||
* -- EN_KILLFOCUS should be handled in WM_COMMAND
|
||||
* -- WM_CREATE: create the icon and small icon image lists at this point only if
|
||||
* the LVS_SHAREIMAGELISTS style is not specified.
|
||||
* -- WM_ERASEBKGND: forward this message to the parent window if the bkgnd
|
||||
* color is CLR_NONE.
|
||||
* -- WM_WINDOWPOSCHANGED: arrange the list items if the current view is icon
|
||||
* or small icon and the LVS_AUTOARRANGE style is specified.
|
||||
* -- WM_TIMER
|
||||
* -- WM_WININICHANGE
|
||||
*
|
||||
* Features
|
||||
* -- Hot item handling, mouse hovering
|
||||
* -- Workareas support
|
||||
|
@ -74,6 +85,8 @@
|
|||
* -- LVS_NOLABELWRAP
|
||||
* -- LVS_NOSCROLL (see Q137520)
|
||||
* -- LVS_SORTASCENDING, LVS_SORTDESCENDING
|
||||
* -- LVS_ALIGNTOP
|
||||
* -- LVS_TYPESTYLEMASK
|
||||
*
|
||||
* Extended Styles
|
||||
* -- LVS_EX_BORDERSELECT
|
||||
|
@ -99,6 +112,7 @@
|
|||
* -- LVN_ODFINDITEM
|
||||
* -- LVN_SETDISPINFO
|
||||
* -- NM_HOVER
|
||||
* -- LVN_BEGINRDRAG
|
||||
*
|
||||
* Messages:
|
||||
* -- LVM_CANCELEDITLABEL
|
||||
|
@ -130,6 +144,20 @@
|
|||
* -- LVM_SORTGROUPS
|
||||
* -- LVM_SORTITEMSEX
|
||||
*
|
||||
* Macros:
|
||||
* -- ListView_GetCheckSate, ListView_SetCheckState
|
||||
* -- ListView_GetHoverTime, ListView_SetHoverTime
|
||||
* -- ListView_GetISearchString
|
||||
* -- ListView_GetNumberOfWorkAreas
|
||||
* -- ListView_GetOrigin
|
||||
* -- ListView_GetTextBkColor
|
||||
* -- ListView_GetUnicodeFormat, ListView_SetUnicodeFormat
|
||||
* -- ListView_GetWorkAreas, ListView_SetWorkAreas
|
||||
* -- ListView_SortItemsEx
|
||||
*
|
||||
* Functions:
|
||||
* -- LVGroupComparE
|
||||
*
|
||||
* Known differences in message stream from native control (not known if
|
||||
* these differences cause problems):
|
||||
* LVM_INSERTITEM issues LVM_SETITEMSTATE and LVM_SETITEM in certain cases.
|
||||
|
@ -225,6 +253,7 @@ typedef struct tagLISTVIEW_INFO
|
|||
HIMAGELIST himlState;
|
||||
BOOL bLButtonDown;
|
||||
BOOL bRButtonDown;
|
||||
POINT ptClickPos; /* point where the user clicked */
|
||||
BOOL bNoItemMetrics; /* flags if item metrics are not yet computed */
|
||||
INT nItemHeight;
|
||||
INT nItemWidth;
|
||||
|
@ -394,6 +423,7 @@ static INT LISTVIEW_GetTopIndex(LISTVIEW_INFO *);
|
|||
static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *, INT, BOOL);
|
||||
static HWND CreateEditLabelT(LISTVIEW_INFO *, LPCWSTR, DWORD, INT, INT, INT, INT, BOOL);
|
||||
static HIMAGELIST LISTVIEW_SetImageList(LISTVIEW_INFO *, INT, HIMAGELIST);
|
||||
static INT LISTVIEW_HitTest(LISTVIEW_INFO *, LPLVHITTESTINFO, BOOL, BOOL);
|
||||
|
||||
/******** Text handling functions *************************************/
|
||||
|
||||
|
@ -3143,6 +3173,22 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem)
|
|||
return bResult;
|
||||
}
|
||||
|
||||
static BOOL LISTVIEW_GetItemAtPt(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, POINT pt)
|
||||
{
|
||||
LVHITTESTINFO lvHitTestInfo;
|
||||
|
||||
ZeroMemory(&lvHitTestInfo, sizeof(lvHitTestInfo));
|
||||
lvHitTestInfo.pt.x = pt.x;
|
||||
lvHitTestInfo.pt.y = pt.y;
|
||||
|
||||
LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, FALSE);
|
||||
|
||||
lpLVItem->mask = LVIF_PARAM;
|
||||
lpLVItem->iItem = lvHitTestInfo.iItem;
|
||||
lpLVItem->iSubItem = 0;
|
||||
|
||||
return LISTVIEW_GetItemT(infoPtr, lpLVItem, TRUE);
|
||||
}
|
||||
|
||||
/***
|
||||
* DESCRIPTION:
|
||||
|
@ -3164,9 +3210,17 @@ static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *infoPtr, INT nItem)
|
|||
*/
|
||||
static LRESULT LISTVIEW_MouseHover(LISTVIEW_INFO *infoPtr, WORD fwKyes, INT x, INT y)
|
||||
{
|
||||
if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)
|
||||
/* FIXME: select the item!!! */
|
||||
/*LISTVIEW_GetItemAtPt(infoPtr, pt)*/;
|
||||
if (infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT)
|
||||
{
|
||||
LVITEMW item;
|
||||
POINT pt;
|
||||
|
||||
pt.x = x;
|
||||
pt.y = y;
|
||||
|
||||
if (LISTVIEW_GetItemAtPt(infoPtr, &item, pt))
|
||||
LISTVIEW_SetSelection(infoPtr, item.iItem);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3187,6 +3241,23 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN
|
|||
{
|
||||
TRACKMOUSEEVENT trackinfo;
|
||||
|
||||
if (infoPtr->bLButtonDown && DragDetect(infoPtr->hwndSelf, infoPtr->ptClickPos))
|
||||
{
|
||||
LVHITTESTINFO lvHitTestInfo;
|
||||
NMLISTVIEW nmlv;
|
||||
|
||||
lvHitTestInfo.pt = infoPtr->ptClickPos;
|
||||
LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE);
|
||||
|
||||
ZeroMemory(&nmlv, sizeof(nmlv));
|
||||
nmlv.iItem = lvHitTestInfo.iItem;
|
||||
nmlv.ptAction = infoPtr->ptClickPos;
|
||||
|
||||
notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* see if we are supposed to be tracking mouse hovering */
|
||||
if(infoPtr->dwLvExStyle & LVS_EX_TRACKSELECT) {
|
||||
/* fill in the trackinfo struct */
|
||||
|
@ -7490,6 +7561,25 @@ fail:
|
|||
return -1;
|
||||
}
|
||||
|
||||
/***
|
||||
* DESCRIPTION:
|
||||
* Enables the listview control.
|
||||
*
|
||||
* PARAMETER(S):
|
||||
* [I] infoPtr : valid pointer to the listview structure
|
||||
* [I] bEnable : specifies whether to enable or disable the window
|
||||
*
|
||||
* RETURN:
|
||||
* SUCCESS : TRUE
|
||||
* FAILURE : FALSE
|
||||
*/
|
||||
static BOOL LISTVIEW_Enable(LISTVIEW_INFO *infoPtr, BOOL bEnable)
|
||||
{
|
||||
if (infoPtr->dwStyle & LVS_OWNERDRAWFIXED)
|
||||
InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/***
|
||||
* DESCRIPTION:
|
||||
* Erases the background of the listview control.
|
||||
|
@ -7905,68 +7995,6 @@ static LRESULT LISTVIEW_KillFocus(LISTVIEW_INFO *infoPtr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* DESCRIPTION:
|
||||
* Track mouse/dragging
|
||||
*
|
||||
* PARAMETER(S):
|
||||
* [I] infoPtr : valid pointer to the listview structure
|
||||
* [I] pt : mouse coordinate
|
||||
*
|
||||
* RETURN:
|
||||
* Zero
|
||||
*/
|
||||
static LRESULT LISTVIEW_TrackMouse(LISTVIEW_INFO *infoPtr, POINT pt)
|
||||
{
|
||||
INT cxDrag = GetSystemMetrics(SM_CXDRAG);
|
||||
INT cyDrag = GetSystemMetrics(SM_CYDRAG);
|
||||
RECT r;
|
||||
MSG msg;
|
||||
|
||||
TRACE("\n");
|
||||
|
||||
r.top = pt.y - cyDrag;
|
||||
r.left = pt.x - cxDrag;
|
||||
r.bottom = pt.y + cyDrag;
|
||||
r.right = pt.x + cxDrag;
|
||||
|
||||
SetCapture(infoPtr->hwndSelf);
|
||||
|
||||
while (1)
|
||||
{
|
||||
if (PeekMessageW(&msg, 0, 0, 0, PM_REMOVE | PM_NOYIELD))
|
||||
{
|
||||
if (msg.message == WM_MOUSEMOVE)
|
||||
{
|
||||
pt.x = (short)LOWORD(msg.lParam);
|
||||
pt.y = (short)HIWORD(msg.lParam);
|
||||
if (PtInRect(&r, pt))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
ReleaseCapture();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else if (msg.message >= WM_LBUTTONDOWN &&
|
||||
msg.message <= WM_RBUTTONDBLCLK)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
DispatchMessageW(&msg);
|
||||
}
|
||||
|
||||
if (GetCapture() != infoPtr->hwndSelf)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ReleaseCapture();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* DESCRIPTION:
|
||||
* Processes double click messages (left mouse button).
|
||||
|
@ -8027,8 +8055,9 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN
|
|||
|
||||
if (!infoPtr->bFocus) SetFocus(infoPtr->hwndSelf);
|
||||
|
||||
/* set left button down flag */
|
||||
/* set left button down flag and record the click position */
|
||||
infoPtr->bLButtonDown = TRUE;
|
||||
infoPtr->ptClickPos = pt;
|
||||
|
||||
lvHitTestInfo.pt.x = x;
|
||||
lvHitTestInfo.pt.y = y;
|
||||
|
@ -8051,19 +8080,6 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
if (LISTVIEW_TrackMouse(infoPtr, lvHitTestInfo.pt))
|
||||
{
|
||||
NMLISTVIEW nmlv;
|
||||
|
||||
ZeroMemory(&nmlv, sizeof(nmlv));
|
||||
nmlv.iItem = nItem;
|
||||
nmlv.ptAction.x = lvHitTestInfo.pt.x;
|
||||
nmlv.ptAction.y = lvHitTestInfo.pt.y;
|
||||
|
||||
notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (infoPtr->dwStyle & LVS_SINGLESEL)
|
||||
{
|
||||
|
@ -8292,6 +8308,11 @@ static LRESULT LISTVIEW_HeaderNotification(LISTVIEW_INFO *infoPtr, const NMHEADE
|
|||
notify_listview(infoPtr, LVN_COLUMNCLICK, &nmlv);
|
||||
}
|
||||
break;
|
||||
|
||||
case HDN_DIVIDERDBLCLICKW:
|
||||
case HDN_DIVIDERDBLCLICKA:
|
||||
LISTVIEW_SetColumnWidth(infoPtr, lpnmh->iItem, LVSCW_AUTOSIZE);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -8621,7 +8642,7 @@ static LRESULT LISTVIEW_SetRedraw(LISTVIEW_INFO *infoPtr, BOOL bRedraw)
|
|||
{
|
||||
TRACE("infoPtr->bRedraw=%d, bRedraw=%d\n", infoPtr->bRedraw, bRedraw);
|
||||
|
||||
/* we can not use straight equality here because _any_ non-zero value is TRUE */
|
||||
/* we cannot use straight equality here because _any_ non-zero value is TRUE */
|
||||
if ((infoPtr->bRedraw && bRedraw) || (!infoPtr->bRedraw && !bRedraw)) return 0;
|
||||
|
||||
infoPtr->bRedraw = bRedraw;
|
||||
|
@ -9194,6 +9215,9 @@ LISTVIEW_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_CREATE:
|
||||
return LISTVIEW_Create(hwnd, (LPCREATESTRUCTW)lParam);
|
||||
|
||||
case WM_ENABLE:
|
||||
return LISTVIEW_Enable(infoPtr, (BOOL)wParam);
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
return LISTVIEW_EraseBkgnd(infoPtr, (HDC)wParam);
|
||||
|
||||
|
|
|
@ -473,29 +473,23 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
|
|||
SetTextColor(hdc, infoPtr->titletxt);
|
||||
currentFont = SelectObject(hdc, infoPtr->hBoldFont);
|
||||
|
||||
/* titlemonth->left and right are set in MONTHCAL_UpdateSize */
|
||||
titlemonth->left = title->left;
|
||||
titlemonth->right = title->right;
|
||||
|
||||
GetLocaleInfoW( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1,
|
||||
buf1,countof(buf1));
|
||||
wsprintfW(buf, fmt1W, buf1, infoPtr->currentYear);
|
||||
|
||||
if(IntersectRect(&rcTemp, &(ps->rcPaint), titlemonth))
|
||||
if(IntersectRect(&rcTemp, &(ps->rcPaint), title))
|
||||
{
|
||||
DrawTextW(hdc, buf, strlenW(buf), titlemonth,
|
||||
DrawTextW(hdc, buf, strlenW(buf), title,
|
||||
DT_CENTER | DT_VCENTER | DT_SINGLELINE);
|
||||
}
|
||||
|
||||
SelectObject(hdc, infoPtr->hFont);
|
||||
|
||||
/* titlemonth left/right contained rect for whole titletxt('June 1999')
|
||||
* MCM_HitTestInfo wants month & year rects, so prepare these now.
|
||||
*(no, we can't draw them separately; the whole text is centered)
|
||||
*/
|
||||
GetTextExtentPoint32W(hdc, buf, strlenW(buf), &size);
|
||||
titlemonth->left = title->right / 2 - size.cx / 2;
|
||||
titleyear->right = title->right / 2 + size.cx / 2;
|
||||
titlemonth->left = title->right / 2 + title->left / 2 - size.cx / 2;
|
||||
titleyear->right = title->right / 2 + title->left / 2 + size.cx / 2;
|
||||
GetTextExtentPoint32W(hdc, buf1, strlenW(buf1), &size);
|
||||
titlemonth->right = titlemonth->left + size.cx;
|
||||
titleyear->left = titlemonth->right;
|
||||
|
@ -524,6 +518,7 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
|
|||
infoPtr->wdays.left = infoPtr->days.left = infoPtr->weeknums.right;
|
||||
/* draw day abbreviations */
|
||||
|
||||
SelectObject(hdc, infoPtr->hFont);
|
||||
SetBkColor(hdc, infoPtr->monthbk);
|
||||
SetTextColor(hdc, infoPtr->trailingtxt);
|
||||
|
||||
|
@ -673,9 +668,9 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, PAINTSTRUCT* ps)
|
|||
wsprintfW(buf, fmt2W, buf1, buf2);
|
||||
SelectObject(hdc, infoPtr->hBoldFont);
|
||||
|
||||
DrawTextW(hdc, buf, -1, &rtoday, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
||||
if(IntersectRect(&rcTemp, &(ps->rcPaint), &rtoday))
|
||||
{
|
||||
DrawTextW(hdc, buf, -1, &rtoday, DT_CALCRECT | DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
||||
DrawTextW(hdc, buf, -1, &rtoday, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
|
||||
}
|
||||
SelectObject(hdc, infoPtr->hFont);
|
||||
|
@ -1424,18 +1419,19 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam)
|
|||
0,
|
||||
WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT,
|
||||
infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top,
|
||||
infoPtr->titleyear.right-infoPtr->titleyear.left,
|
||||
infoPtr->titleyear.right-infoPtr->titleyear.left+4,
|
||||
infoPtr->textHeight,
|
||||
infoPtr->hwndSelf,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL);
|
||||
SendMessageW( infoPtr->hWndYearEdit, WM_SETFONT, (WPARAM) infoPtr->hBoldFont, (LPARAM)TRUE);
|
||||
infoPtr->hWndYearUpDown=CreateWindowExW(0,
|
||||
UPDOWN_CLASSW,
|
||||
0,
|
||||
WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS,
|
||||
infoPtr->titleyear.right+6,infoPtr->titlebtnnext.top,
|
||||
20,
|
||||
infoPtr->titleyear.right+7,infoPtr->titlebtnnext.top,
|
||||
18,
|
||||
infoPtr->textHeight,
|
||||
infoPtr->hwndSelf,
|
||||
NULL,
|
||||
|
@ -1733,7 +1729,7 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr)
|
|||
|
||||
xdiv = (dwStyle & MCS_WEEKNUMBERS) ? 8 : 7;
|
||||
|
||||
infoPtr->width_increment = size.cx * 2;
|
||||
infoPtr->width_increment = size.cx * 2 + 4;
|
||||
infoPtr->height_increment = infoPtr->textHeight;
|
||||
left_offset = (rcClient.right - rcClient.left) - (infoPtr->width_increment * xdiv);
|
||||
|
||||
|
@ -1852,7 +1848,7 @@ MONTHCAL_Create(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
/* initialize info structure */
|
||||
/* FIXME: calculate systemtime ->> localtime(substract timezoneinfo) */
|
||||
|
||||
GetSystemTime(&infoPtr->todaysDate);
|
||||
GetLocalTime(&infoPtr->todaysDate);
|
||||
MONTHCAL_SetFirstDayOfWeek(infoPtr, (LPARAM)-1);
|
||||
infoPtr->currentMonth = infoPtr->todaysDate.wMonth;
|
||||
infoPtr->currentYear = infoPtr->todaysDate.wYear;
|
||||
|
|
|
@ -1727,12 +1727,12 @@ TAB_DrawItemInterior
|
|||
else
|
||||
drawRect->bottom-=center_offset_h;
|
||||
|
||||
center_offset_v = ((drawRect->right - drawRect->left) - ((rcText.bottom - rcText.top) + infoPtr->uVItemPadding)) / 2;
|
||||
center_offset_v = ((drawRect->right - drawRect->left) - (rcText.bottom - rcText.top) + infoPtr->uVItemPadding) / 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
drawRect->left += center_offset_h;
|
||||
center_offset_v = ((drawRect->bottom - drawRect->top) - ((rcText.bottom - rcText.top) + infoPtr->uVItemPadding)) / 2;
|
||||
center_offset_v = ((drawRect->bottom - drawRect->top) - (rcText.bottom - rcText.top) + infoPtr->uVItemPadding) / 2;
|
||||
}
|
||||
|
||||
if (center_offset_v < 0)
|
||||
|
@ -2961,6 +2961,13 @@ TAB_Destroy (TAB_INFO *infoPtr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static LRESULT TAB_NCCalcSize(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if (!wParam)
|
||||
return 0;
|
||||
return WVR_ALIGNTOP;
|
||||
}
|
||||
|
||||
static inline LRESULT
|
||||
TAB_SetItemExtra (TAB_INFO *infoPtr, INT cbInfo)
|
||||
{
|
||||
|
@ -3143,6 +3150,9 @@ TAB_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
case WM_NCHITTEST:
|
||||
return TAB_NCHitTest(infoPtr, lParam);
|
||||
|
||||
case WM_NCCALCSIZE:
|
||||
return TAB_NCCalcSize(hwnd, wParam, lParam);
|
||||
|
||||
default:
|
||||
if (uMsg >= WM_USER && uMsg < WM_APP)
|
||||
WARN("unknown msg %04x wp=%08x lp=%08lx\n",
|
||||
|
|
|
@ -6233,7 +6233,7 @@ TOOLBAR_NCCreate (HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
* forgets to specify TBSTYLE_TRANSPARENT but does specify either
|
||||
* CCS_TOP or CCS_BOTTOM (_NOMOVEY and _TOP), then the control
|
||||
* does *not* set TBSTYLE_TRANSPARENT even though it should!!!!
|
||||
* Some how, the only cases of this seem to be MFC programs.
|
||||
* Somehow, the only cases of this seem to be MFC programs.
|
||||
*
|
||||
* Note also that the addition of _TRANSPARENT occurs *only* here. It
|
||||
* does not occur in the WM_STYLECHANGING routine.
|
||||
|
|
|
@ -775,9 +775,12 @@ static LRESULT WINAPI UpDownWindowProc(HWND hwnd, UINT message, WPARAM wParam, L
|
|||
break;
|
||||
|
||||
case WM_ENABLE:
|
||||
if (wParam) {
|
||||
infoPtr->dwStyle &= ~WS_DISABLED;
|
||||
infoPtr->dwStyle |= (wParam ? 0 : WS_DISABLED);
|
||||
if (infoPtr->dwStyle & WS_DISABLED) UPDOWN_CancelMode (infoPtr);
|
||||
} else {
|
||||
infoPtr->dwStyle |= WS_DISABLED;
|
||||
UPDOWN_CancelMode (infoPtr);
|
||||
}
|
||||
InvalidateRect (infoPtr->Self, NULL, FALSE);
|
||||
break;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ TOPOBJDIR = ../..
|
|||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = comdlg32.dll
|
||||
IMPORTLIB = libcomdlg32.$(IMPLIBEXT)
|
||||
IMPORTS = shell32 shlwapi comctl32 winspool user32 gdi32 kernel32 ntdll
|
||||
EXTRALIBS = -luuid
|
||||
|
||||
|
@ -22,7 +23,6 @@ C_SRCS16 = \
|
|||
filedlg16.c \
|
||||
finddlg.c \
|
||||
fontdlg16.c \
|
||||
generic.c \
|
||||
printdlg16.c
|
||||
|
||||
SPEC_SRCS16 = commdlg.spec
|
||||
|
|
|
@ -24,4 +24,3 @@
|
|||
#29 pascal DWLBSUBCLASS exported, shared data
|
||||
#30 pascal DWUPARROWHACK exported, shared data
|
||||
#31 pascal DWOKSUBCLASS exported, shared data
|
||||
32 pascal DllEntryPoint(long word word word long word) COMMDLG_DllEntryPoint
|
||||
|
|
|
@ -1835,7 +1835,13 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
|
|||
|
||||
TRACE("parse now=%s next=%s sf=%p\n",debugstr_w(lpwstrTemp), debugstr_w(lpszTemp), lpsf);
|
||||
|
||||
if(lstrlenW(lpwstrTemp)==2) PathAddBackslashW(lpwstrTemp);
|
||||
/* append a backslash to drive letters */
|
||||
if(lstrlenW(lpwstrTemp)==2 && lpwstrTemp[1] == ':' &&
|
||||
((lpwstrTemp[0] >= 'a' && lpwstrTemp[0] <= 'z') ||
|
||||
(lpwstrTemp[0] >= 'A' && lpwstrTemp[0] <= 'Z')))
|
||||
{
|
||||
PathAddBackslashW(lpwstrTemp);
|
||||
}
|
||||
|
||||
dwAttributes = SFGAO_FOLDER;
|
||||
if(SUCCEEDED(IShellFolder_ParseDisplayName(lpsf, hwnd, NULL, lpwstrTemp, &dwEaten, &pidl, &dwAttributes)))
|
||||
|
|
|
@ -776,7 +776,8 @@ HRESULT WINAPI IShellBrowserImpl_ICommDlgBrowser_OnDefaultCommand(ICommDlgBrowse
|
|||
else
|
||||
{
|
||||
/* Tell the dialog that the user selected a file */
|
||||
hRes = PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);
|
||||
PostMessageA(This->hwndOwner, WM_COMMAND, IDOK, 0L);
|
||||
hRes = S_OK;
|
||||
}
|
||||
|
||||
/* Free memory used by pidl */
|
||||
|
|
|
@ -1024,18 +1024,15 @@ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam,
|
|||
LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpcfw)
|
||||
{
|
||||
LPCHOOSEFONTA lpcfa;
|
||||
LPCSTR lpTemplateName;
|
||||
LPSTR lpszStyle;
|
||||
LPLOGFONTA lpLogFonta;
|
||||
int len;
|
||||
|
||||
lpcfa = GetPropW(hwnd, strWineFontData_a);
|
||||
lpLogFonta = lpcfa->lpLogFont;
|
||||
lpTemplateName = lpcfa->lpTemplateName;
|
||||
lpszStyle = lpcfa->lpszStyle;
|
||||
memcpy(lpcfa, lpcfw, sizeof(CHOOSEFONTA));
|
||||
lpcfa->lpLogFont = lpLogFonta;
|
||||
lpcfa->lpTemplateName = lpTemplateName;
|
||||
lpcfa->lpszStyle = lpszStyle;
|
||||
memcpy(lpcfa->lpLogFont, lpcfw->lpLogFont, sizeof(LOGFONTA));
|
||||
WideCharToMultiByte(CP_ACP, 0, lpcfw->lpLogFont->lfFaceName,
|
||||
|
@ -1047,9 +1044,9 @@ LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpc
|
|||
HeapFree(GetProcessHeap(), 0, lpcfw->lpszStyle);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, (LPBYTE)lpcfw->lpTemplateName);
|
||||
HeapFree(GetProcessHeap(), 0, lpcfw->lpLogFont);
|
||||
HeapFree(GetProcessHeap(), 0, lpcfw);
|
||||
SetPropW(hwnd, strWineFontData, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1141,13 +1138,6 @@ INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam,
|
|||
MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, lpcfw->lpszStyle, len);
|
||||
}
|
||||
|
||||
if((lpcfa->Flags & CF_ENABLETEMPLATE) && lpcfa->lpTemplateName) {
|
||||
len = MultiByteToWideChar(CP_ACP, 0, lpcfa->lpTemplateName, -1, NULL, 0);
|
||||
lpcfw->lpTemplateName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
|
||||
MultiByteToWideChar(CP_ACP, 0, lpcfa->lpTemplateName,
|
||||
-1, (LPWSTR)lpcfw->lpTemplateName, len);
|
||||
}
|
||||
|
||||
if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcfw))
|
||||
{
|
||||
TRACE("CFn_WMInitDialog returned FALSE\n");
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* COMMDLG/COMDLG32 functions
|
||||
*
|
||||
* Copyright 1994 Martin Ayotte
|
||||
* Copyright 1996 Albrecht Kleine
|
||||
* Copyright 1998,1999 Bertho Stultiens
|
||||
* Copyright 1999 Klaas van Gend
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
#include "winuser.h"
|
||||
#include "commdlg.h"
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
|
||||
|
||||
#include "cdlg.h"
|
||||
#include "cdlg16.h"
|
||||
|
||||
/***********************************************************************
|
||||
* DllEntryPoint [COMMDLG.32]
|
||||
*
|
||||
* Initialization code for the COMMDLG DLL
|
||||
*
|
||||
* RETURNS:
|
||||
*/
|
||||
BOOL WINAPI COMMDLG_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD HeapSize, DWORD res1, WORD res2)
|
||||
{
|
||||
TRACE("(%08lx, %04x, %04x, %04x, %08lx, %04x)\n", Reason, hInst, ds, HeapSize, res1, res2);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* CommDlgExtendedError16 [COMMDLG.26]
|
||||
*
|
||||
* Get the last error value if a commdlg function fails.
|
||||
* RETURNS
|
||||
* Current error value which might not be valid
|
||||
* if a previous call succeeded.
|
||||
*/
|
||||
DWORD WINAPI CommDlgExtendedError16(void)
|
||||
{
|
||||
return CommDlgExtendedError();
|
||||
}
|
|
@ -98,7 +98,7 @@ BEGIN
|
|||
IDS_COLOR_4BIT "16 Colors"
|
||||
IDS_COLOR_8BIT "256 Colors"
|
||||
IDS_COLOR_16BIT "High Color (16 Bit)"
|
||||
IDS_COLOR_32BIT "True Color (24 Bit)"
|
||||
IDS_COLOR_24BIT "True Color (24 Bit)"
|
||||
IDS_COLOR_32BIT "True Color (32 Bit)"
|
||||
IDS_PIXEL "%lux%lu Pixel"
|
||||
END
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#define IDS_COLOR_4BIT 2904
|
||||
#define IDS_COLOR_8BIT 2908
|
||||
#define IDS_COLOR_16BIT 2916
|
||||
#define IDS_COLOR_24BIT 2924
|
||||
#define IDS_COLOR_32BIT 2932
|
||||
|
||||
#endif /* __CPL_DESK_RESOURCE_H__ */
|
||||
|
|
|
@ -63,13 +63,17 @@ UpdateDisplay(IN HWND hwndDlg)
|
|||
_stprintf(Buffer, Pixel, CurrentDisplayDevice->CurrentSettings->dmPelsWidth, CurrentDisplayDevice->CurrentSettings->dmPelsHeight, Pixel);
|
||||
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION_TEXT, WM_SETTEXT, 0, (LPARAM)Buffer);
|
||||
|
||||
|
||||
for (index = 0; index < CurrentDisplayDevice->ResolutionsCount; index++)
|
||||
{
|
||||
|
||||
if (CurrentDisplayDevice->Resolutions[index].dmPelsWidth == CurrentDisplayDevice->CurrentSettings->dmPelsWidth &&
|
||||
CurrentDisplayDevice->Resolutions[index].dmPelsHeight == CurrentDisplayDevice->CurrentSettings->dmPelsHeight)
|
||||
{
|
||||
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_RESOLUTION, TBM_SETPOS, TRUE, index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (LoadString(hApplet, (2900 + CurrentDisplayDevice->CurrentSettings->dmBitsPerPel), Buffer, sizeof(Buffer) / sizeof(TCHAR)))
|
||||
SendDlgItemMessage(hwndDlg, IDC_SETTINGS_BPP, CB_SELECTSTRING, -1, (LPARAM)Buffer);
|
||||
}
|
||||
|
@ -84,7 +88,7 @@ GetPossibleSettings(IN LPTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTIN
|
|||
PSETTINGS_ENTRY Settings = NULL;
|
||||
HDC hDC;
|
||||
PSETTINGS_ENTRY Current;
|
||||
DWORD bpp, xres, yres;
|
||||
DWORD bpp, xres, yres, checkbpp;
|
||||
|
||||
/* Get current settings */
|
||||
*CurrentSettings = NULL;
|
||||
|
@ -101,8 +105,11 @@ GetPossibleSettings(IN LPTSTR DeviceName, OUT DWORD* pSettingsCount, OUT PSETTIN
|
|||
while (EnumDisplaySettingsEx(DeviceName, iMode, &devmode, dwFlags))
|
||||
{
|
||||
|
||||
if (devmode.dmBitsPerPel==8 || devmode.dmBitsPerPel==16 || devmode.dmBitsPerPel==24 || devmode.dmBitsPerPel==32) checkbpp=1;
|
||||
else checkbpp=0;
|
||||
|
||||
if (devmode.dmPelsWidth < 640 ||
|
||||
devmode.dmPelsHeight < 480)
|
||||
devmode.dmPelsHeight < 480 || checkbpp == 0)
|
||||
{
|
||||
iMode++;
|
||||
continue;
|
||||
|
|
|
@ -76,7 +76,7 @@ BEGIN
|
|||
IDS_COLOR_4BIT "16 färger"
|
||||
IDS_COLOR_8BIT "256 färger"
|
||||
IDS_COLOR_16BIT "65 536 färger (16 Bit)"
|
||||
IDS_COLOR_32BIT "16,7 miljoner färger (24 Bit)"
|
||||
IDS_COLOR_24BIT "16,7 miljoner färger (24 Bit)"
|
||||
IDS_COLOR_32BIT "16,7 miljoner färger (32 Bit)"
|
||||
IDS_PIXEL "%lux%lu Pixlar"
|
||||
END
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* TODO:
|
||||
* add keyboard
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "windef.h"
|
||||
|
@ -23,7 +27,7 @@
|
|||
|
||||
#define numObjects(x) (sizeof(x) / sizeof(x[0]))
|
||||
|
||||
static const DIOBJECTDATAFORMAT dfDIJoystick[] = {
|
||||
DIOBJECTDATAFORMAT dfDIJoystick[] = {
|
||||
{ &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
|
||||
{ &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
|
||||
{ &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
|
||||
|
@ -76,10 +80,10 @@ const DIDATAFORMAT c_dfDIJoystick = {
|
|||
DIDF_ABSAXIS,
|
||||
sizeof(DIJOYSTATE2),
|
||||
numObjects(dfDIJoystick),
|
||||
(LPDIOBJECTDATAFORMAT)dfDIJoystick
|
||||
dfDIJoystick
|
||||
};
|
||||
|
||||
static const DIOBJECTDATAFORMAT dfDIJoystick2[] = {
|
||||
DIOBJECTDATAFORMAT dfDIJoystick2[] = {
|
||||
{ &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
|
||||
{ &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
|
||||
{ &GUID_ZAxis,DIJOFS_Z,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
|
||||
|
@ -252,10 +256,10 @@ const DIDATAFORMAT c_dfDIJoystick2 = {
|
|||
DIDF_ABSAXIS,
|
||||
sizeof(DIJOYSTATE2),
|
||||
numObjects(dfDIJoystick2),
|
||||
(LPDIOBJECTDATAFORMAT)dfDIJoystick2
|
||||
dfDIJoystick2
|
||||
};
|
||||
|
||||
static const DIOBJECTDATAFORMAT dfDIMouse[] = {
|
||||
DIOBJECTDATAFORMAT dfDIMouse[] = {
|
||||
{ &GUID_XAxis, DIMOFS_X, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 },
|
||||
{ &GUID_YAxis, DIMOFS_Y, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 },
|
||||
{ &GUID_ZAxis, DIMOFS_Z, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 },
|
||||
|
@ -271,10 +275,10 @@ const DIDATAFORMAT c_dfDIMouse = {
|
|||
DIDF_RELAXIS,
|
||||
sizeof(DIMOUSESTATE),
|
||||
numObjects(dfDIMouse),
|
||||
(LPDIOBJECTDATAFORMAT)dfDIMouse
|
||||
dfDIMouse
|
||||
};
|
||||
|
||||
static const DIOBJECTDATAFORMAT dfDIMouse2[] = {
|
||||
DIOBJECTDATAFORMAT dfDIMouse2[] = {
|
||||
{ &GUID_XAxis, DIMOFS_X, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 },
|
||||
{ &GUID_YAxis, DIMOFS_Y, DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 },
|
||||
{ &GUID_ZAxis, DIMOFS_Z, DIDFT_OPTIONAL | DIDFT_ANYINSTANCE | DIDFT_AXIS, 0 },
|
||||
|
@ -294,273 +298,5 @@ const DIDATAFORMAT c_dfDIMouse2 = {
|
|||
DIDF_RELAXIS,
|
||||
sizeof(DIMOUSESTATE2),
|
||||
numObjects(dfDIMouse2),
|
||||
(LPDIOBJECTDATAFORMAT)dfDIMouse2
|
||||
};
|
||||
|
||||
static const DIOBJECTDATAFORMAT dfDIKeyboard[] = {
|
||||
{ &GUID_Key,0,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(0),0},
|
||||
{ &GUID_Key,1,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(1),0},
|
||||
{ &GUID_Key,2,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(2),0},
|
||||
{ &GUID_Key,3,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(3),0},
|
||||
{ &GUID_Key,4,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(4),0},
|
||||
{ &GUID_Key,5,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(5),0},
|
||||
{ &GUID_Key,6,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(6),0},
|
||||
{ &GUID_Key,7,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(7),0},
|
||||
{ &GUID_Key,8,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(8),0},
|
||||
{ &GUID_Key,9,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(9),0},
|
||||
{ &GUID_Key,10,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(10),0},
|
||||
{ &GUID_Key,11,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(11),0},
|
||||
{ &GUID_Key,12,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(12),0},
|
||||
{ &GUID_Key,13,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(13),0},
|
||||
{ &GUID_Key,14,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(14),0},
|
||||
{ &GUID_Key,15,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(15),0},
|
||||
{ &GUID_Key,16,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(16),0},
|
||||
{ &GUID_Key,17,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(17),0},
|
||||
{ &GUID_Key,18,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(18),0},
|
||||
{ &GUID_Key,19,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(19),0},
|
||||
{ &GUID_Key,20,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(20),0},
|
||||
{ &GUID_Key,21,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(21),0},
|
||||
{ &GUID_Key,22,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(22),0},
|
||||
{ &GUID_Key,23,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(23),0},
|
||||
{ &GUID_Key,24,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(24),0},
|
||||
{ &GUID_Key,25,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(25),0},
|
||||
{ &GUID_Key,26,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(26),0},
|
||||
{ &GUID_Key,27,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(27),0},
|
||||
{ &GUID_Key,28,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(28),0},
|
||||
{ &GUID_Key,29,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(29),0},
|
||||
{ &GUID_Key,30,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(30),0},
|
||||
{ &GUID_Key,31,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(31),0},
|
||||
{ &GUID_Key,32,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(32),0},
|
||||
{ &GUID_Key,33,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(33),0},
|
||||
{ &GUID_Key,34,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(34),0},
|
||||
{ &GUID_Key,35,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(35),0},
|
||||
{ &GUID_Key,36,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(36),0},
|
||||
{ &GUID_Key,37,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(37),0},
|
||||
{ &GUID_Key,38,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(38),0},
|
||||
{ &GUID_Key,39,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(39),0},
|
||||
{ &GUID_Key,40,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(40),0},
|
||||
{ &GUID_Key,41,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(41),0},
|
||||
{ &GUID_Key,42,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(42),0},
|
||||
{ &GUID_Key,43,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(43),0},
|
||||
{ &GUID_Key,44,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(44),0},
|
||||
{ &GUID_Key,45,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(45),0},
|
||||
{ &GUID_Key,46,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(46),0},
|
||||
{ &GUID_Key,47,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(47),0},
|
||||
{ &GUID_Key,48,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(48),0},
|
||||
{ &GUID_Key,49,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(49),0},
|
||||
{ &GUID_Key,50,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(50),0},
|
||||
{ &GUID_Key,51,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(51),0},
|
||||
{ &GUID_Key,52,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(52),0},
|
||||
{ &GUID_Key,53,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(53),0},
|
||||
{ &GUID_Key,54,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(54),0},
|
||||
{ &GUID_Key,55,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(55),0},
|
||||
{ &GUID_Key,56,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(56),0},
|
||||
{ &GUID_Key,57,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(57),0},
|
||||
{ &GUID_Key,58,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(58),0},
|
||||
{ &GUID_Key,59,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(59),0},
|
||||
{ &GUID_Key,60,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(60),0},
|
||||
{ &GUID_Key,61,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(61),0},
|
||||
{ &GUID_Key,62,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(62),0},
|
||||
{ &GUID_Key,63,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(63),0},
|
||||
{ &GUID_Key,64,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(64),0},
|
||||
{ &GUID_Key,65,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(65),0},
|
||||
{ &GUID_Key,66,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(66),0},
|
||||
{ &GUID_Key,67,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(67),0},
|
||||
{ &GUID_Key,68,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(68),0},
|
||||
{ &GUID_Key,69,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(69),0},
|
||||
{ &GUID_Key,70,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(70),0},
|
||||
{ &GUID_Key,71,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(71),0},
|
||||
{ &GUID_Key,72,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(72),0},
|
||||
{ &GUID_Key,73,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(73),0},
|
||||
{ &GUID_Key,74,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(74),0},
|
||||
{ &GUID_Key,75,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(75),0},
|
||||
{ &GUID_Key,76,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(76),0},
|
||||
{ &GUID_Key,77,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(77),0},
|
||||
{ &GUID_Key,78,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(78),0},
|
||||
{ &GUID_Key,79,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(79),0},
|
||||
{ &GUID_Key,80,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(80),0},
|
||||
{ &GUID_Key,81,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(81),0},
|
||||
{ &GUID_Key,82,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(82),0},
|
||||
{ &GUID_Key,83,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(83),0},
|
||||
{ &GUID_Key,84,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(84),0},
|
||||
{ &GUID_Key,85,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(85),0},
|
||||
{ &GUID_Key,86,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(86),0},
|
||||
{ &GUID_Key,87,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(87),0},
|
||||
{ &GUID_Key,88,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(88),0},
|
||||
{ &GUID_Key,89,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(89),0},
|
||||
{ &GUID_Key,90,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(90),0},
|
||||
{ &GUID_Key,91,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(91),0},
|
||||
{ &GUID_Key,92,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(92),0},
|
||||
{ &GUID_Key,93,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(93),0},
|
||||
{ &GUID_Key,94,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(94),0},
|
||||
{ &GUID_Key,95,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(95),0},
|
||||
{ &GUID_Key,96,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(96),0},
|
||||
{ &GUID_Key,97,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(97),0},
|
||||
{ &GUID_Key,98,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(98),0},
|
||||
{ &GUID_Key,99,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(99),0},
|
||||
{ &GUID_Key,100,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(100),0},
|
||||
{ &GUID_Key,101,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(101),0},
|
||||
{ &GUID_Key,102,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(102),0},
|
||||
{ &GUID_Key,103,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(103),0},
|
||||
{ &GUID_Key,104,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(104),0},
|
||||
{ &GUID_Key,105,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(105),0},
|
||||
{ &GUID_Key,106,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(106),0},
|
||||
{ &GUID_Key,107,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(107),0},
|
||||
{ &GUID_Key,108,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(108),0},
|
||||
{ &GUID_Key,109,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(109),0},
|
||||
{ &GUID_Key,110,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(110),0},
|
||||
{ &GUID_Key,111,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(111),0},
|
||||
{ &GUID_Key,112,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(112),0},
|
||||
{ &GUID_Key,113,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(113),0},
|
||||
{ &GUID_Key,114,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(114),0},
|
||||
{ &GUID_Key,115,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(115),0},
|
||||
{ &GUID_Key,116,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(116),0},
|
||||
{ &GUID_Key,117,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(117),0},
|
||||
{ &GUID_Key,118,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(118),0},
|
||||
{ &GUID_Key,119,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(119),0},
|
||||
{ &GUID_Key,120,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(120),0},
|
||||
{ &GUID_Key,121,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(121),0},
|
||||
{ &GUID_Key,122,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(122),0},
|
||||
{ &GUID_Key,123,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(123),0},
|
||||
{ &GUID_Key,124,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(124),0},
|
||||
{ &GUID_Key,125,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(125),0},
|
||||
{ &GUID_Key,126,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(126),0},
|
||||
{ &GUID_Key,127,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(127),0},
|
||||
{ &GUID_Key,128,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(128),0},
|
||||
{ &GUID_Key,129,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(129),0},
|
||||
{ &GUID_Key,130,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(130),0},
|
||||
{ &GUID_Key,131,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(131),0},
|
||||
{ &GUID_Key,132,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(132),0},
|
||||
{ &GUID_Key,133,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(133),0},
|
||||
{ &GUID_Key,134,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(134),0},
|
||||
{ &GUID_Key,135,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(135),0},
|
||||
{ &GUID_Key,136,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(136),0},
|
||||
{ &GUID_Key,137,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(137),0},
|
||||
{ &GUID_Key,138,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(138),0},
|
||||
{ &GUID_Key,139,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(139),0},
|
||||
{ &GUID_Key,140,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(140),0},
|
||||
{ &GUID_Key,141,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(141),0},
|
||||
{ &GUID_Key,142,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(142),0},
|
||||
{ &GUID_Key,143,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(143),0},
|
||||
{ &GUID_Key,144,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(144),0},
|
||||
{ &GUID_Key,145,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(145),0},
|
||||
{ &GUID_Key,146,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(146),0},
|
||||
{ &GUID_Key,147,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(147),0},
|
||||
{ &GUID_Key,148,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(148),0},
|
||||
{ &GUID_Key,149,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(149),0},
|
||||
{ &GUID_Key,150,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(150),0},
|
||||
{ &GUID_Key,151,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(151),0},
|
||||
{ &GUID_Key,152,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(152),0},
|
||||
{ &GUID_Key,153,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(153),0},
|
||||
{ &GUID_Key,154,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(154),0},
|
||||
{ &GUID_Key,155,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(155),0},
|
||||
{ &GUID_Key,156,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(156),0},
|
||||
{ &GUID_Key,157,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(157),0},
|
||||
{ &GUID_Key,158,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(158),0},
|
||||
{ &GUID_Key,159,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(159),0},
|
||||
{ &GUID_Key,160,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(160),0},
|
||||
{ &GUID_Key,161,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(161),0},
|
||||
{ &GUID_Key,162,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(162),0},
|
||||
{ &GUID_Key,163,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(163),0},
|
||||
{ &GUID_Key,164,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(164),0},
|
||||
{ &GUID_Key,165,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(165),0},
|
||||
{ &GUID_Key,166,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(166),0},
|
||||
{ &GUID_Key,167,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(167),0},
|
||||
{ &GUID_Key,168,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(168),0},
|
||||
{ &GUID_Key,169,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(169),0},
|
||||
{ &GUID_Key,170,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(170),0},
|
||||
{ &GUID_Key,171,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(171),0},
|
||||
{ &GUID_Key,172,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(172),0},
|
||||
{ &GUID_Key,173,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(173),0},
|
||||
{ &GUID_Key,174,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(174),0},
|
||||
{ &GUID_Key,175,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(175),0},
|
||||
{ &GUID_Key,176,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(176),0},
|
||||
{ &GUID_Key,177,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(177),0},
|
||||
{ &GUID_Key,178,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(178),0},
|
||||
{ &GUID_Key,179,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(179),0},
|
||||
{ &GUID_Key,180,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(180),0},
|
||||
{ &GUID_Key,181,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(181),0},
|
||||
{ &GUID_Key,182,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(182),0},
|
||||
{ &GUID_Key,183,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(183),0},
|
||||
{ &GUID_Key,184,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(184),0},
|
||||
{ &GUID_Key,185,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(185),0},
|
||||
{ &GUID_Key,186,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(186),0},
|
||||
{ &GUID_Key,187,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(187),0},
|
||||
{ &GUID_Key,188,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(188),0},
|
||||
{ &GUID_Key,189,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(189),0},
|
||||
{ &GUID_Key,190,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(190),0},
|
||||
{ &GUID_Key,191,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(191),0},
|
||||
{ &GUID_Key,192,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(192),0},
|
||||
{ &GUID_Key,193,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(193),0},
|
||||
{ &GUID_Key,194,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(194),0},
|
||||
{ &GUID_Key,195,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(195),0},
|
||||
{ &GUID_Key,196,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(196),0},
|
||||
{ &GUID_Key,197,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(197),0},
|
||||
{ &GUID_Key,198,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(198),0},
|
||||
{ &GUID_Key,199,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(199),0},
|
||||
{ &GUID_Key,200,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(200),0},
|
||||
{ &GUID_Key,201,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(201),0},
|
||||
{ &GUID_Key,202,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(202),0},
|
||||
{ &GUID_Key,203,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(203),0},
|
||||
{ &GUID_Key,204,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(204),0},
|
||||
{ &GUID_Key,205,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(205),0},
|
||||
{ &GUID_Key,206,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(206),0},
|
||||
{ &GUID_Key,207,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(207),0},
|
||||
{ &GUID_Key,208,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(208),0},
|
||||
{ &GUID_Key,209,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(209),0},
|
||||
{ &GUID_Key,210,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(210),0},
|
||||
{ &GUID_Key,211,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(211),0},
|
||||
{ &GUID_Key,212,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(212),0},
|
||||
{ &GUID_Key,213,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(213),0},
|
||||
{ &GUID_Key,214,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(214),0},
|
||||
{ &GUID_Key,215,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(215),0},
|
||||
{ &GUID_Key,216,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(216),0},
|
||||
{ &GUID_Key,217,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(217),0},
|
||||
{ &GUID_Key,218,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(218),0},
|
||||
{ &GUID_Key,219,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(219),0},
|
||||
{ &GUID_Key,220,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(220),0},
|
||||
{ &GUID_Key,221,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(221),0},
|
||||
{ &GUID_Key,222,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(222),0},
|
||||
{ &GUID_Key,223,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(223),0},
|
||||
{ &GUID_Key,224,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(224),0},
|
||||
{ &GUID_Key,225,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(225),0},
|
||||
{ &GUID_Key,226,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(226),0},
|
||||
{ &GUID_Key,227,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(227),0},
|
||||
{ &GUID_Key,228,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(228),0},
|
||||
{ &GUID_Key,229,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(229),0},
|
||||
{ &GUID_Key,230,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(230),0},
|
||||
{ &GUID_Key,231,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(231),0},
|
||||
{ &GUID_Key,232,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(232),0},
|
||||
{ &GUID_Key,233,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(233),0},
|
||||
{ &GUID_Key,234,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(234),0},
|
||||
{ &GUID_Key,235,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(235),0},
|
||||
{ &GUID_Key,236,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(236),0},
|
||||
{ &GUID_Key,237,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(237),0},
|
||||
{ &GUID_Key,238,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(238),0},
|
||||
{ &GUID_Key,239,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(239),0},
|
||||
{ &GUID_Key,240,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(240),0},
|
||||
{ &GUID_Key,241,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(241),0},
|
||||
{ &GUID_Key,242,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(242),0},
|
||||
{ &GUID_Key,243,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(243),0},
|
||||
{ &GUID_Key,244,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(244),0},
|
||||
{ &GUID_Key,245,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(245),0},
|
||||
{ &GUID_Key,246,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(246),0},
|
||||
{ &GUID_Key,247,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(247),0},
|
||||
{ &GUID_Key,248,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(248),0},
|
||||
{ &GUID_Key,249,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(249),0},
|
||||
{ &GUID_Key,250,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(250),0},
|
||||
{ &GUID_Key,251,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(251),0},
|
||||
{ &GUID_Key,252,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(252),0},
|
||||
{ &GUID_Key,253,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(253),0},
|
||||
{ &GUID_Key,254,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(254),0},
|
||||
{ &GUID_Key,255,DIDFT_OPTIONAL|DIDFT_BUTTON|DIDFT_MAKEINSTANCE(255),0}
|
||||
};
|
||||
|
||||
const DIDATAFORMAT c_dfDIKeyboard = {
|
||||
sizeof(DIDATAFORMAT),
|
||||
sizeof(DIOBJECTDATAFORMAT),
|
||||
DIDF_RELAXIS,
|
||||
256,
|
||||
numObjects(dfDIKeyboard),
|
||||
(LPDIOBJECTDATAFORMAT)dfDIKeyboard
|
||||
dfDIMouse2
|
||||
};
|
||||
|
|
|
@ -290,12 +290,12 @@ DataFormat *create_DataFormat(const DIDATAFORMAT *wine_format, LPCDIDATAFORMAT a
|
|||
int index = 0;
|
||||
DWORD next = 0;
|
||||
|
||||
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
|
||||
ret = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
|
||||
|
||||
done = HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs);
|
||||
done = (int *) HeapAlloc(GetProcessHeap(), 0, sizeof(int) * asked_format->dwNumObjs);
|
||||
memset(done, 0, sizeof(int) * asked_format->dwNumObjs);
|
||||
|
||||
dt = HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform));
|
||||
dt = (DataTransform *) HeapAlloc(GetProcessHeap(), 0, asked_format->dwNumObjs * sizeof(DataTransform));
|
||||
|
||||
TRACE("Creating DataTransform : \n");
|
||||
|
||||
|
|
|
@ -53,14 +53,10 @@ static IDirectInput7WVtbl ddi7wvt;
|
|||
static IDirectInput8AVtbl ddi8avt;
|
||||
static IDirectInput8WVtbl ddi8wvt;
|
||||
|
||||
static const struct dinput_device *dinput_devices[] =
|
||||
{
|
||||
&mouse_device,
|
||||
&keyboard_device,
|
||||
&joystick_linuxinput_device,
|
||||
&joystick_linux_device
|
||||
};
|
||||
#define NB_DINPUT_DEVICES (sizeof(dinput_devices)/sizeof(dinput_devices[0]))
|
||||
/* This array will be filled a dinput.so loading */
|
||||
#define MAX_WINE_DINPUT_DEVICES 4
|
||||
static dinput_device * dinput_devices[MAX_WINE_DINPUT_DEVICES];
|
||||
static int nrof_dinput_devices = 0;
|
||||
|
||||
HINSTANCE DINPUT_instance = NULL;
|
||||
|
||||
|
@ -78,7 +74,28 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserv)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* register a direct draw driver. We better not use malloc for we are in
|
||||
* the ELF startup initialisation at this point.
|
||||
*/
|
||||
void dinput_register_device(dinput_device *device) {
|
||||
int i;
|
||||
|
||||
/* insert according to priority */
|
||||
for (i=0;i<nrof_dinput_devices;i++) {
|
||||
if (dinput_devices[i]->pref <= device->pref) {
|
||||
memcpy(dinput_devices+i+1,dinput_devices+i,sizeof(dinput_devices[0])*(nrof_dinput_devices-i));
|
||||
dinput_devices[i] = device;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i==nrof_dinput_devices) /* not found, or too low priority */
|
||||
dinput_devices[nrof_dinput_devices] = device;
|
||||
|
||||
nrof_dinput_devices++;
|
||||
|
||||
/* increase MAX_DDRAW_DRIVERS if the line below triggers */
|
||||
assert(nrof_dinput_devices <= MAX_WINE_DINPUT_DEVICES);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* DirectInputCreateEx (DINPUT.@)
|
||||
|
@ -94,7 +111,7 @@ HRESULT WINAPI DirectInputCreateEx(
|
|||
if (IsEqualGUID(&IID_IDirectInputA,riid) ||
|
||||
IsEqualGUID(&IID_IDirectInput2A,riid) ||
|
||||
IsEqualGUID(&IID_IDirectInput7A,riid)) {
|
||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This->lpVtbl = &ddi7avt;
|
||||
This->ref = 1;
|
||||
This->version = 1;
|
||||
|
@ -106,7 +123,7 @@ HRESULT WINAPI DirectInputCreateEx(
|
|||
if (IsEqualGUID(&IID_IDirectInputW,riid) ||
|
||||
IsEqualGUID(&IID_IDirectInput2W,riid) ||
|
||||
IsEqualGUID(&IID_IDirectInput7W,riid)) {
|
||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This->lpVtbl = &ddi7wvt;
|
||||
This->ref = 1;
|
||||
This->version = 1;
|
||||
|
@ -116,7 +133,7 @@ HRESULT WINAPI DirectInputCreateEx(
|
|||
}
|
||||
|
||||
if (IsEqualGUID(&IID_IDirectInput8A,riid)) {
|
||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This->lpVtbl = &ddi8avt;
|
||||
This->ref = 1;
|
||||
This->version = 8;
|
||||
|
@ -126,7 +143,7 @@ HRESULT WINAPI DirectInputCreateEx(
|
|||
}
|
||||
|
||||
if (IsEqualGUID(&IID_IDirectInput8W,riid)) {
|
||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This->lpVtbl = &ddi8wvt;
|
||||
This->ref = 1;
|
||||
This->version = 8;
|
||||
|
@ -147,7 +164,7 @@ HRESULT WINAPI DirectInputCreateA(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPU
|
|||
TRACE("(0x%08lx,%04lx,%p,%p)\n", (DWORD)hinst,dwVersion,ppDI,punkOuter);
|
||||
|
||||
//trace:dinput:DirectInputCreateA (0x00400000,0500,0x42bafc54,(nil))
|
||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This->lpVtbl = &ddi7avt;
|
||||
This->ref = 1;
|
||||
if (dwVersion > 0x0700) {
|
||||
|
@ -168,7 +185,7 @@ HRESULT WINAPI DirectInputCreateW(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPU
|
|||
{
|
||||
IDirectInputImpl* This;
|
||||
TRACE("(0x%08lx,%04lx,%p,%p)\n", (DWORD)hinst,dwVersion,ppDI,punkOuter);
|
||||
This = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This = (IDirectInputImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDirectInputImpl));
|
||||
This->lpVtbl = &ddi7wvt;
|
||||
This->ref = 1;
|
||||
if (dwVersion >= 0x0800) {
|
||||
|
@ -231,22 +248,16 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices(
|
|||
TRACE("(this=%p,0x%04lx '%s',%p,%p,%04lx)\n",
|
||||
This, dwDevType, _dump_DIDEVTYPE_value(dwDevType),
|
||||
lpCallback, pvRef, dwFlags);
|
||||
#ifdef __REACTOS__
|
||||
/* hack geting keyboard and mouse working */
|
||||
if (NB_DINPUT_DEVICES==0){
|
||||
|
||||
if (nrof_dinput_devices==0){
|
||||
scan_mouse();
|
||||
scan_keyboard();
|
||||
}
|
||||
#endif
|
||||
|
||||
TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n");
|
||||
|
||||
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++) {
|
||||
#ifndef __REACTOS__
|
||||
/* Wine Dinput does not support windows enum
|
||||
we need a hack here */
|
||||
if (!dinput_devices[i]->enum_deviceA) continue;
|
||||
#endif
|
||||
for (i = 0; i < nrof_dinput_devices; i++) {
|
||||
for (j = 0, r = -1; r != 0; j++) {
|
||||
devInstance.dwSize = sizeof(devInstance);
|
||||
TRACE(" - checking device %d ('%s')\n", i, dinput_devices[i]->name);
|
||||
|
@ -272,13 +283,10 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
|
|||
DIDEVICEINSTANCEW devInstance;
|
||||
int i, j, r;
|
||||
|
||||
#ifdef __REACTOS__
|
||||
/* hack geting keyboard and mouse working */
|
||||
if (NB_DINPUT_DEVICES==0){
|
||||
if (nrof_dinput_devices==0){
|
||||
scan_mouse();
|
||||
scan_keyboard();
|
||||
}
|
||||
#endif
|
||||
|
||||
TRACE("(this=%p,0x%04lx '%s',%p,%p,%04lx)\n",
|
||||
This, dwDevType, _dump_DIDEVTYPE_value(dwDevType),
|
||||
|
@ -286,13 +294,7 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
|
|||
TRACE(" flags: "); _dump_EnumDevices_dwFlags(dwFlags); TRACE("\n");
|
||||
|
||||
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++) {
|
||||
#ifndef __REACTOS__
|
||||
/* Wine Dinput does not support windows enum
|
||||
we need a hack here */
|
||||
if (!dinput_devices[i]->enum_deviceW) continue;
|
||||
#endif
|
||||
|
||||
for (i = 0; i < nrof_dinput_devices; i++) {
|
||||
for (j = 0, r = -1; r != 0; j++) {
|
||||
devInstance.dwSize = sizeof(devInstance);
|
||||
TRACE(" - checking device %d ('%s')\n", i, dinput_devices[i]->name);
|
||||
|
@ -364,18 +366,14 @@ static HRESULT WINAPI IDirectInputAImpl_CreateDevice(
|
|||
|
||||
TRACE("(this=%p,%s,%p,%p)\n",This,debugstr_guid(rguid),pdev,punk);
|
||||
|
||||
#ifdef __REACTOS__
|
||||
/* hack geting keyboard and mouse working */
|
||||
if (NB_DINPUT_DEVICES==0){
|
||||
if (nrof_dinput_devices==0){
|
||||
scan_mouse();
|
||||
scan_keyboard();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Loop on all the devices to see if anyone matches the given GUID */
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++) {
|
||||
for (i = 0; i < nrof_dinput_devices; i++) {
|
||||
HRESULT ret;
|
||||
if (!dinput_devices[i]->create_deviceA) continue;
|
||||
if ((ret = dinput_devices[i]->create_deviceA(This, rguid, NULL, pdev)) == DI_OK)
|
||||
return DI_OK;
|
||||
|
||||
|
@ -394,18 +392,14 @@ static HRESULT WINAPI IDirectInputWImpl_CreateDevice(LPDIRECTINPUT7A iface,
|
|||
|
||||
TRACE("(this=%p,%s,%p,%p)\n",This,debugstr_guid(rguid),pdev,punk);
|
||||
|
||||
#ifdef __REACTOS__
|
||||
/* hack geting keyboard and mouse working */
|
||||
if (NB_DINPUT_DEVICES==0){
|
||||
if (nrof_dinput_devices==0){
|
||||
scan_mouse();
|
||||
scan_keyboard();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Loop on all the devices to see if anyone matches the given GUID */
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++) {
|
||||
for (i = 0; i < nrof_dinput_devices; i++) {
|
||||
HRESULT ret;
|
||||
if (!dinput_devices[i]->create_deviceW) continue;
|
||||
if ((ret = dinput_devices[i]->create_deviceW(This, rguid, NULL, pdev)) == DI_OK)
|
||||
return DI_OK;
|
||||
|
||||
|
@ -463,18 +457,14 @@ static HRESULT WINAPI IDirectInput7AImpl_CreateDeviceEx(LPDIRECTINPUT7A iface, R
|
|||
|
||||
TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter);
|
||||
|
||||
#ifdef __REACTOS__
|
||||
/* hack geting keyboard and mouse working */
|
||||
if (NB_DINPUT_DEVICES==0){
|
||||
if (nrof_dinput_devices==0){
|
||||
scan_mouse();
|
||||
scan_keyboard();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Loop on all the devices to see if anyone matches the given GUID */
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++) {
|
||||
for (i = 0; i < nrof_dinput_devices; i++) {
|
||||
HRESULT ret;
|
||||
if (!dinput_devices[i]->create_deviceA) continue;
|
||||
if ((ret = dinput_devices[i]->create_deviceA(This, rguid, riid, (LPDIRECTINPUTDEVICEA*) pvOut)) == DI_OK)
|
||||
return DI_OK;
|
||||
|
||||
|
@ -494,7 +484,7 @@ static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx(LPDIRECTINPUT7W iface, R
|
|||
|
||||
TRACE("(%p)->(%s, %s, %p, %p)\n", This, debugstr_guid(rguid), debugstr_guid(riid), pvOut, lpUnknownOuter);
|
||||
|
||||
if (NB_DINPUT_DEVICES==0){
|
||||
if (nrof_dinput_devices==0){
|
||||
scan_mouse();
|
||||
scan_keyboard();
|
||||
}
|
||||
|
@ -502,9 +492,8 @@ static HRESULT WINAPI IDirectInput7WImpl_CreateDeviceEx(LPDIRECTINPUT7W iface, R
|
|||
|
||||
|
||||
/* Loop on all the devices to see if anyone matches the given GUID */
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++) {
|
||||
for (i = 0; i < nrof_dinput_devices; i++) {
|
||||
HRESULT ret;
|
||||
if (!dinput_devices[i]->create_deviceW) continue;
|
||||
if ((ret = dinput_devices[i]->create_deviceW(This, rguid, riid, (LPDIRECTINPUTDEVICEW*) pvOut)) == DI_OK)
|
||||
return DI_OK;
|
||||
|
||||
|
|
|
@ -39,18 +39,16 @@ struct IDirectInputImpl
|
|||
};
|
||||
|
||||
/* Function called by all devices that Wine supports */
|
||||
struct dinput_device {
|
||||
typedef struct dinput_device {
|
||||
INT pref;
|
||||
const char *name;
|
||||
BOOL (*enum_deviceA)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEA lpddi, int version, int id);
|
||||
BOOL (*enum_deviceW)(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEINSTANCEW lpddi, int version, int id);
|
||||
HRESULT (*create_deviceA)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEA* pdev);
|
||||
HRESULT (*create_deviceW)(IDirectInputImpl *dinput, REFGUID rguid, REFIID riid, LPDIRECTINPUTDEVICEW* pdev);
|
||||
};
|
||||
} dinput_device;
|
||||
|
||||
extern const struct dinput_device mouse_device;
|
||||
extern const struct dinput_device keyboard_device;
|
||||
extern const struct dinput_device joystick_linux_device;
|
||||
extern const struct dinput_device joystick_linuxinput_device;
|
||||
extern void dinput_register_device(dinput_device *device);
|
||||
|
||||
extern HINSTANCE DINPUT_instance;
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#ifdef HAVE_LINUX_22_JOYSTICK_API
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
@ -53,6 +55,7 @@
|
|||
#ifdef HAVE_LINUX_JOYSTICK_H
|
||||
# include <linux/joystick.h>
|
||||
#endif
|
||||
#define JOYDEV "/dev/js"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
|
@ -67,10 +70,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
|
||||
|
||||
#ifdef HAVE_LINUX_22_JOYSTICK_API
|
||||
|
||||
#define JOYDEV "/dev/js"
|
||||
|
||||
typedef struct {
|
||||
LONG lMin;
|
||||
LONG lMax;
|
||||
|
@ -647,7 +646,8 @@ static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, RE
|
|||
return DIERR_DEVICENOTREG;
|
||||
}
|
||||
|
||||
const struct dinput_device joystick_linux_device = {
|
||||
static dinput_device joydev = {
|
||||
10,
|
||||
"Wine Linux joystick driver",
|
||||
joydev_enum_deviceA,
|
||||
joydev_enum_deviceW,
|
||||
|
@ -655,6 +655,8 @@ const struct dinput_device joystick_linux_device = {
|
|||
joydev_create_deviceW
|
||||
};
|
||||
|
||||
DECL_GLOBAL_CONSTRUCTOR(joydev_register) { dinput_register_device(&joydev); }
|
||||
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -1695,14 +1697,4 @@ static IDirectInputDevice8WVtbl SysJoystickWvt =
|
|||
};
|
||||
#undef XCAST
|
||||
|
||||
#else /* HAVE_LINUX_22_JOYSTICK_API */
|
||||
|
||||
const struct dinput_device joystick_linux_device = {
|
||||
"Wine Linux joystick driver",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
#endif /* HAVE_LINUX_22_JOYSTICK_API */
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include "config.h"
|
||||
#include "wine/port.h"
|
||||
|
||||
#ifdef HAVE_LINUX_INPUT_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -41,10 +43,16 @@
|
|||
#ifdef HAVE_SYS_ERRNO_H
|
||||
# include <sys/errno.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CORRECT_LINUXINPUT_H
|
||||
|
||||
#ifdef HAVE_LINUX_INPUT_H
|
||||
# include <linux/input.h>
|
||||
#endif
|
||||
|
||||
|
||||
#define EVDEVPREFIX "/dev/input/event"
|
||||
|
||||
#include "wine/debug.h"
|
||||
#include "wine/unicode.h"
|
||||
#include "windef.h"
|
||||
|
@ -57,10 +65,6 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
|
||||
|
||||
#ifdef HAVE_CORRECT_LINUXINPUT_H
|
||||
|
||||
#define EVDEVPREFIX "/dev/input/event"
|
||||
|
||||
/* Wine joystick driver object instances */
|
||||
#define WINE_JOYSTICK_AXIS_BASE 0
|
||||
#define WINE_JOYSTICK_BUTTON_BASE 8
|
||||
|
@ -318,7 +322,8 @@ static HRESULT joydev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid, RE
|
|||
return DIERR_DEVICENOTREG;
|
||||
}
|
||||
|
||||
const struct dinput_device joystick_linuxinput_device = {
|
||||
static dinput_device joydev = {
|
||||
20,
|
||||
"Wine Linux-input joystick driver",
|
||||
joydev_enum_deviceA,
|
||||
joydev_enum_deviceW,
|
||||
|
@ -326,6 +331,8 @@ const struct dinput_device joystick_linuxinput_device = {
|
|||
joydev_create_deviceW
|
||||
};
|
||||
|
||||
DECL_GLOBAL_CONSTRUCTOR(joydev_register) { dinput_register_device(&joydev); }
|
||||
|
||||
/******************************************************************************
|
||||
* Joystick
|
||||
*/
|
||||
|
@ -971,7 +978,7 @@ static HRESULT WINAPI JoystickAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
|
|||
{
|
||||
JoystickImpl *This = (JoystickImpl *)iface;
|
||||
|
||||
TRACE("(this=%p,%s,%p)\n",
|
||||
TRACE("(this=%p,%s,%p): stub!\n",
|
||||
iface, debugstr_guid(rguid), pdiph);
|
||||
|
||||
if (TRACE_ON(dinput))
|
||||
|
@ -1087,14 +1094,6 @@ static IDirectInputDevice8WVtbl JoystickWvt =
|
|||
};
|
||||
#undef XCAST
|
||||
|
||||
#else /* HAVE_CORRECT_LINUXINPUT_H */
|
||||
#endif /* HAVE_LINUX_INPUT_H */
|
||||
|
||||
const struct dinput_device joystick_linuxinput_device = {
|
||||
"Wine Linux-input joystick driver",
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
#endif /* HAVE_CORRECT_LINUXINPUT_H */
|
||||
#endif
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* Copyright 1998 Marcus Meissner
|
||||
* Copyright 1998,1999 Lionel Ulmer
|
||||
* Copyright 2000-2001 TransGaming Technologies Inc.
|
||||
* Copyright 2005 Raphael Junqueira
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
@ -38,7 +37,10 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
|
||||
|
||||
#define WINE_DINPUT_KEYBOARD_MAX_KEYS 256
|
||||
//fast fix misning from mingw headers
|
||||
#ifdef __REACTOS__
|
||||
#define LLKHF_INJECTED 0x00000010
|
||||
#endif
|
||||
|
||||
static IDirectInputDevice8AVtbl SysKeyboardAvt;
|
||||
static IDirectInputDevice8WVtbl SysKeyboardWvt;
|
||||
|
@ -68,15 +70,14 @@ struct SysKeyboardImpl
|
|||
CRITICAL_SECTION crit;
|
||||
};
|
||||
|
||||
static SysKeyboardImpl* current_lock = NULL;
|
||||
/* Today's acquired device
|
||||
* FIXME: currently this can be only one.
|
||||
* Maybe this should be a linked list or st.
|
||||
* I don't know what the rules are for multiple acquired keyboards,
|
||||
* but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason.
|
||||
SysKeyboardImpl *current; /* Today's acquired device
|
||||
FIXME: currently this can be only one.
|
||||
Maybe this should be a linked list or st.
|
||||
I don't know what the rules are for multiple acquired keyboards,
|
||||
but 'DI_LOSTFOCUS' and 'DI_UNACQUIRED' exist for a reason.
|
||||
*/
|
||||
|
||||
static BYTE DInputKeyState[WINE_DINPUT_KEYBOARD_MAX_KEYS]; /* array for 'GetDeviceState' */
|
||||
static BYTE DInputKeyState[256]; /* array for 'GetDeviceState' */
|
||||
|
||||
static CRITICAL_SECTION keyboard_crit;
|
||||
static CRITICAL_SECTION_DEBUG critsect_debug =
|
||||
|
@ -90,8 +91,7 @@ static CRITICAL_SECTION keyboard_crit = { &critsect_debug, -1, 0, 0, 0, 0 };
|
|||
static DWORD keyboard_users;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
static DWORD keyboard_users = 0;
|
||||
static HHOOK keyboard_hook = NULL;
|
||||
static HHOOK keyboard_hook;
|
||||
#endif
|
||||
|
||||
#ifdef __REACTOS__
|
||||
|
@ -116,24 +116,24 @@ void reactos_input_keyboard()
|
|||
|
||||
|
||||
if (disk_code!=-1) {
|
||||
if (current_lock->buffer != NULL)
|
||||
if (current->buffer != NULL)
|
||||
{
|
||||
int n;
|
||||
n = (current_lock->start + current_lock->count) % current_lock->buffersize;
|
||||
n = (current->start + current->count) % current->buffersize;
|
||||
|
||||
current_lock->buffer[n].dwOfs = (BYTE) disk_code;
|
||||
current_lock->buffer[n].dwData = DInputKeyState[disk_code];
|
||||
current_lock->buffer[n].dwTimeStamp = 10;
|
||||
current_lock->buffer[n].dwSequence = current_lock->dinput->evsequence++;
|
||||
current->buffer[n].dwOfs = (BYTE) disk_code;
|
||||
current->buffer[n].dwData = DInputKeyState[disk_code];
|
||||
current->buffer[n].dwTimeStamp = 10;
|
||||
current->buffer[n].dwSequence = current->dinput->evsequence++;
|
||||
|
||||
|
||||
if (current_lock->count == current_lock->buffersize)
|
||||
if (current->count == current->buffersize)
|
||||
{
|
||||
current_lock->start = ++current_lock->start % current_lock->buffersize;
|
||||
current_lock->overflow = TRUE;
|
||||
current->start = ++current->start % current->buffersize;
|
||||
current->overflow = TRUE;
|
||||
}
|
||||
else
|
||||
current_lock->count++;
|
||||
current->count++;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -144,58 +144,59 @@ void reactos_input_keyboard()
|
|||
#ifndef __REACTOS__
|
||||
LRESULT CALLBACK KeyboardCallback( int code, WPARAM wparam, LPARAM lparam )
|
||||
{
|
||||
TRACE("(%d,%d,%ld)\n", code, wparam, lparam);
|
||||
|
||||
if (code == HC_ACTION)
|
||||
{
|
||||
BYTE dik_code;
|
||||
BOOL down;
|
||||
DWORD timestamp;
|
||||
KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam;
|
||||
BYTE new_diks;
|
||||
|
||||
TRACE("(%d,%d,%ld)\n", code, wparam, lparam);
|
||||
|
||||
/** returns now if not HC_ACTION */
|
||||
if (code != HC_ACTION) return CallNextHookEx(keyboard_hook, code, wparam, lparam);
|
||||
|
||||
{
|
||||
KBDLLHOOKSTRUCT *hook = (KBDLLHOOKSTRUCT *)lparam;
|
||||
dik_code = hook->scanCode;
|
||||
if (hook->flags & LLKHF_EXTENDED) dik_code |= 0x80;
|
||||
down = !(hook->flags & LLKHF_UP);
|
||||
timestamp = hook->time;
|
||||
}
|
||||
|
||||
/** returns now if key event already known */
|
||||
new_diks = (down ? 0x80 : 0);
|
||||
/*if (new_diks != DInputKeyState[dik_code]) return CallNextHookEx(keyboard_hook, code, wparam, lparam); TO BE FIXED */
|
||||
|
||||
DInputKeyState[dik_code] = new_diks;
|
||||
DInputKeyState[dik_code] = (down ? 0x80 : 0);
|
||||
TRACE(" setting %02X to %02X\n", dik_code, DInputKeyState[dik_code]);
|
||||
|
||||
if (current_lock != NULL) {
|
||||
if (current_lock->hEvent) SetEvent(current_lock->hEvent);
|
||||
if (current != NULL)
|
||||
{
|
||||
if (current->hEvent)
|
||||
SetEvent(current->hEvent);
|
||||
|
||||
if (current_lock->buffer != NULL) {
|
||||
if (current->buffer != NULL)
|
||||
{
|
||||
int n;
|
||||
|
||||
EnterCriticalSection(&(current_lock->crit));
|
||||
EnterCriticalSection(&(current->crit));
|
||||
|
||||
n = (current_lock->start + current_lock->count) % current_lock->buffersize;
|
||||
n = (current->start + current->count) % current->buffersize;
|
||||
|
||||
current_lock->buffer[n].dwOfs = dik_code;
|
||||
current_lock->buffer[n].dwData = down ? 0x80 : 0;
|
||||
current_lock->buffer[n].dwTimeStamp = timestamp;
|
||||
current_lock->buffer[n].dwSequence = current_lock->dinput->evsequence++;
|
||||
current->buffer[n].dwOfs = dik_code;
|
||||
current->buffer[n].dwData = down ? 0x80 : 0;
|
||||
current->buffer[n].dwTimeStamp = timestamp;
|
||||
current->buffer[n].dwSequence = current->dinput->evsequence++;
|
||||
|
||||
TRACE("Adding event at offset %d : %ld - %ld - %ld - %ld\n", n,
|
||||
current_lock->buffer[n].dwOfs, current_lock->buffer[n].dwData, current_lock->buffer[n].dwTimeStamp, current_lock->buffer[n].dwSequence);
|
||||
current->buffer[n].dwOfs, current->buffer[n].dwData, current->buffer[n].dwTimeStamp, current->buffer[n].dwSequence);
|
||||
|
||||
if (current_lock->count == current_lock->buffersize) {
|
||||
current_lock->start = ++current_lock->start % current_lock->buffersize;
|
||||
current_lock->overflow = TRUE;
|
||||
} else
|
||||
current_lock->count++;
|
||||
if (current->count == current->buffersize)
|
||||
{
|
||||
current->start = ++current->start % current->buffersize;
|
||||
current->overflow = TRUE;
|
||||
}
|
||||
else
|
||||
current->count++;
|
||||
|
||||
LeaveCriticalSection(&(current_lock->crit));
|
||||
LeaveCriticalSection(&(current->crit));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CallNextHookEx(keyboard_hook, code, wparam, lparam);
|
||||
}
|
||||
#endif
|
||||
|
@ -294,27 +295,17 @@ static BOOL keyboarddev_enum_deviceW(DWORD dwDevType, DWORD dwFlags, LPDIDEVICEI
|
|||
static SysKeyboardImpl *alloc_device_keyboard(REFGUID rguid, LPVOID kvt, IDirectInputImpl *dinput)
|
||||
{
|
||||
SysKeyboardImpl* newDevice;
|
||||
DWORD kbd_users;
|
||||
|
||||
newDevice = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(SysKeyboardImpl));
|
||||
newDevice->lpVtbl = kvt;
|
||||
newDevice->ref = 1;
|
||||
memcpy(&(newDevice->guid),rguid,sizeof(*rguid));
|
||||
newDevice->dinput = dinput;
|
||||
InitializeCriticalSection(&(newDevice->crit));
|
||||
|
||||
#ifndef __REACTOS__
|
||||
EnterCriticalSection(&keyboard_crit);
|
||||
<<<<<<< .working
|
||||
|
||||
if (!keyboard_users++)
|
||||
keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 );
|
||||
=======
|
||||
kbd_users = InterlockedIncrement(&keyboard_users);
|
||||
if (1 == kbd_users) {
|
||||
keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 );
|
||||
}
|
||||
>>>>>>> .merge-right.r14821
|
||||
|
||||
LeaveCriticalSection(&keyboard_crit);
|
||||
#endif
|
||||
|
@ -358,7 +349,8 @@ static HRESULT keyboarddev_create_deviceW(IDirectInputImpl *dinput, REFGUID rgui
|
|||
return DIERR_DEVICENOTREG;
|
||||
}
|
||||
|
||||
const struct dinput_device keyboard_device = {
|
||||
dinput_device keyboarddev = {
|
||||
100,
|
||||
"Wine keyboard driver",
|
||||
keyboarddev_enum_deviceA,
|
||||
keyboarddev_enum_deviceW,
|
||||
|
@ -366,11 +358,17 @@ const struct dinput_device keyboard_device = {
|
|||
keyboarddev_create_deviceW
|
||||
};
|
||||
|
||||
void scan_keyboard()
|
||||
{
|
||||
dinput_register_device(&keyboarddev);
|
||||
}
|
||||
|
||||
DECL_GLOBAL_CONSTRUCTOR(keyboarddev_register) { dinput_register_device(&keyboarddev); }
|
||||
|
||||
static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
||||
{
|
||||
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
||||
ULONG ref;
|
||||
DWORD kbd_users;
|
||||
|
||||
ref = InterlockedDecrement(&(This->ref));
|
||||
if (ref)
|
||||
|
@ -378,8 +376,7 @@ static ULONG WINAPI SysKeyboardAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
|||
|
||||
#ifndef __REACTOS__
|
||||
EnterCriticalSection(&keyboard_crit);
|
||||
kbd_users = InterlockedDecrement(&keyboard_users);
|
||||
if (0 == kbd_users) {
|
||||
if (!--keyboard_users) {
|
||||
UnhookWindowsHookEx( keyboard_hook );
|
||||
keyboard_hook = 0;
|
||||
}
|
||||
|
@ -426,68 +423,33 @@ static HRESULT WINAPI SysKeyboardAImpl_SetProperty(
|
|||
return DI_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI SysKeyboardAImpl_GetProperty(
|
||||
LPDIRECTINPUTDEVICE8A iface,REFGUID rguid,LPDIPROPHEADER ph
|
||||
)
|
||||
{
|
||||
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
||||
|
||||
TRACE("(this=%p,%s,%p)\n",This,debugstr_guid(rguid),ph);
|
||||
TRACE("(size=%ld,headersize=%ld,obj=%ld,how=%ld\n",
|
||||
ph->dwSize,ph->dwHeaderSize,ph->dwObj,ph->dwHow);
|
||||
if (!HIWORD(rguid)) {
|
||||
switch ((DWORD)rguid) {
|
||||
case (DWORD) DIPROP_BUFFERSIZE: {
|
||||
LPDIPROPDWORD pd = (LPDIPROPDWORD)ph;
|
||||
|
||||
TRACE("(buffersize=%ld)\n",pd->dwData);
|
||||
|
||||
if (This->acquired)
|
||||
return DIERR_INVALIDPARAM;
|
||||
|
||||
pd->dwData = This->buffersize;
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
WARN("Unknown type %ld\n",(DWORD)rguid);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI SysKeyboardAImpl_GetDeviceState(
|
||||
LPDIRECTINPUTDEVICE8A iface,DWORD len,LPVOID ptr
|
||||
)
|
||||
{
|
||||
SysKeyboardImpl *This = (SysKeyboardImpl *)iface;
|
||||
TRACE("(%p)->(%ld,%p)\n", This, len, ptr);
|
||||
TRACE("(%p)->(%ld,%p)\n", iface, len, ptr);
|
||||
|
||||
#ifdef __REACTOS__
|
||||
reactos_input_keyboard();
|
||||
#endif
|
||||
|
||||
/* Note: device does not need to be acquired */
|
||||
if (len != WINE_DINPUT_KEYBOARD_MAX_KEYS)
|
||||
if (len != 256)
|
||||
return DIERR_INVALIDPARAM;
|
||||
|
||||
MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, 0);
|
||||
|
||||
EnterCriticalSection(&(This->crit));
|
||||
MsgWaitForMultipleObjectsEx(0, NULL, 0, 0, 0);
|
||||
|
||||
if (TRACE_ON(dinput)) {
|
||||
int i;
|
||||
for (i = 0; i < WINE_DINPUT_KEYBOARD_MAX_KEYS; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
if (DInputKeyState[i] != 0x00) {
|
||||
TRACE(" - %02X: %02x\n", i, DInputKeyState[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
memcpy(ptr, DInputKeyState, WINE_DINPUT_KEYBOARD_MAX_KEYS);
|
||||
LeaveCriticalSection(&(This->crit));
|
||||
|
||||
memcpy(ptr, DInputKeyState, 256);
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
|
@ -515,7 +477,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceData(
|
|||
if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3))
|
||||
return DIERR_INVALIDPARAM;
|
||||
|
||||
MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, 0);
|
||||
MsgWaitForMultipleObjectsEx(0, NULL, 0, 0, 0);
|
||||
|
||||
EnterCriticalSection(&(This->crit));
|
||||
|
||||
|
@ -576,7 +538,7 @@ static HRESULT WINAPI SysKeyboardAImpl_EnumObjects(
|
|||
memset(&ddoi, 0, sizeof(ddoi));
|
||||
ddoi.dwSize = FIELD_OFFSET(DIDEVICEOBJECTINSTANCEA, dwFFMaxForce);
|
||||
|
||||
for (i = 0; i < WINE_DINPUT_KEYBOARD_MAX_KEYS; i++) {
|
||||
for (i = 0; i < 256; i++) {
|
||||
/* Report 255 keys :-) */
|
||||
ddoi.guidType = GUID_Key;
|
||||
ddoi.dwOfs = i;
|
||||
|
@ -617,24 +579,26 @@ static HRESULT WINAPI SysKeyboardAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
|
||||
This->acquired = 1;
|
||||
|
||||
if (current_lock != NULL) {
|
||||
if (current != NULL)
|
||||
{
|
||||
FIXME("Not more than one keyboard can be acquired at the same time.\n");
|
||||
SysKeyboardAImpl_Unacquire(iface);
|
||||
}
|
||||
|
||||
current_lock = This;
|
||||
current = This;
|
||||
|
||||
if (This->buffersize > 0) {
|
||||
if (This->buffersize > 0)
|
||||
{
|
||||
This->buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
This->buffersize * sizeof(*(This->buffer)));
|
||||
This->start = 0;
|
||||
This->count = 0;
|
||||
This->overflow = FALSE;
|
||||
} else {
|
||||
This->buffer = NULL;
|
||||
InitializeCriticalSection(&(This->crit));
|
||||
}
|
||||
else
|
||||
This->buffer = NULL;
|
||||
|
||||
/*keyboard_hook = SetWindowsHookExW( WH_KEYBOARD_LL, KeyboardCallback, DINPUT_instance, 0 );*/
|
||||
|
||||
return DI_OK;
|
||||
}
|
||||
|
@ -647,18 +611,18 @@ static HRESULT WINAPI SysKeyboardAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
if (This->acquired == 0)
|
||||
return DI_NOEFFECT;
|
||||
|
||||
/* No more locks */
|
||||
if (current_lock == This)
|
||||
current_lock = NULL;
|
||||
if (current == This)
|
||||
current = NULL;
|
||||
else
|
||||
ERR("this != current_lock\n");
|
||||
ERR("this != current\n");
|
||||
|
||||
/* Unacquire device */
|
||||
This->acquired = 0;
|
||||
|
||||
if (This->buffersize >= 0) {
|
||||
if (This->buffersize >= 0)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, This->buffer);
|
||||
This->buffer = NULL;
|
||||
DeleteCriticalSection(&(This->crit));
|
||||
}
|
||||
|
||||
return DI_OK;
|
||||
|
@ -698,7 +662,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetCapabilities(
|
|||
else
|
||||
devcaps.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8);
|
||||
devcaps.dwAxes = 0;
|
||||
devcaps.dwButtons = WINE_DINPUT_KEYBOARD_MAX_KEYS;
|
||||
devcaps.dwButtons = 256;
|
||||
devcaps.dwPOVs = 0;
|
||||
devcaps.dwFFSamplePeriod = 0;
|
||||
devcaps.dwFFMinTimeResolution = 0;
|
||||
|
@ -794,7 +758,7 @@ static HRESULT WINAPI SysKeyboardAImpl_GetDeviceInfo(
|
|||
TRACE("(this=%p,%p)\n", This, pdidi);
|
||||
|
||||
if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEA)) {
|
||||
WARN(" dinput3 not supported yet...\n");
|
||||
WARN(" dinput3 not supporte yet...\n");
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
|
@ -809,7 +773,7 @@ static HRESULT WINAPI SysKeyboardWImpl_GetDeviceInfo(LPDIRECTINPUTDEVICE8W iface
|
|||
TRACE("(this=%p,%p)\n", This, pdidi);
|
||||
|
||||
if (pdidi->dwSize != sizeof(DIDEVICEINSTANCEW)) {
|
||||
WARN(" dinput3 not supported yet...\n");
|
||||
WARN(" dinput3 not supporte yet...\n");
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
|
@ -825,7 +789,7 @@ static IDirectInputDevice8AVtbl SysKeyboardAvt =
|
|||
SysKeyboardAImpl_Release,
|
||||
SysKeyboardAImpl_GetCapabilities,
|
||||
SysKeyboardAImpl_EnumObjects,
|
||||
SysKeyboardAImpl_GetProperty,
|
||||
IDirectInputDevice2AImpl_GetProperty,
|
||||
SysKeyboardAImpl_SetProperty,
|
||||
SysKeyboardAImpl_Acquire,
|
||||
SysKeyboardAImpl_Unacquire,
|
||||
|
@ -867,7 +831,7 @@ static IDirectInputDevice8WVtbl SysKeyboardWvt =
|
|||
XCAST(Release)SysKeyboardAImpl_Release,
|
||||
XCAST(GetCapabilities)SysKeyboardAImpl_GetCapabilities,
|
||||
SysKeyboardWImpl_EnumObjects,
|
||||
XCAST(GetProperty)SysKeyboardAImpl_GetProperty,
|
||||
XCAST(GetProperty)IDirectInputDevice2AImpl_GetProperty,
|
||||
XCAST(SetProperty)SysKeyboardAImpl_SetProperty,
|
||||
XCAST(Acquire)SysKeyboardAImpl_Acquire,
|
||||
XCAST(Unacquire)SysKeyboardAImpl_Unacquire,
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(dinput);
|
||||
|
||||
|
||||
/* Wine mouse driver object instances */
|
||||
#define WINE_MOUSE_X_AXIS_INSTANCE 0
|
||||
#define WINE_MOUSE_Y_AXIS_INSTANCE 1
|
||||
|
@ -264,7 +265,7 @@ static SysMouseImpl *alloc_device_mouse(REFGUID rguid, LPVOID mvt, IDirectInputI
|
|||
/* Per default, Wine uses its internal data format */
|
||||
newDevice->df = (DIDATAFORMAT *) &Wine_InternalMouseFormat;
|
||||
memcpy(newDevice->offset_array, offset_array, WINE_INTERNALMOUSE_NUM_OBJS * sizeof(int));
|
||||
newDevice->wine_df = HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
|
||||
newDevice->wine_df = (DataFormat *) HeapAlloc(GetProcessHeap(), 0, sizeof(DataFormat));
|
||||
newDevice->wine_df->size = 0;
|
||||
newDevice->wine_df->internal_format_size = Wine_InternalMouseFormat.dwDataSize;
|
||||
newDevice->wine_df->dt = NULL;
|
||||
|
@ -311,7 +312,8 @@ static HRESULT mousedev_create_deviceW(IDirectInputImpl *dinput, REFGUID rguid,
|
|||
return DIERR_DEVICENOTREG;
|
||||
}
|
||||
|
||||
const struct dinput_device mouse_device = {
|
||||
static dinput_device mousedev = {
|
||||
100,
|
||||
"Wine mouse driver",
|
||||
mousedev_enum_deviceA,
|
||||
mousedev_enum_deviceW,
|
||||
|
@ -319,6 +321,15 @@ const struct dinput_device mouse_device = {
|
|||
mousedev_create_deviceW
|
||||
};
|
||||
|
||||
#ifdef __REACTOS__
|
||||
void scan_mouse()
|
||||
{
|
||||
dinput_register_device(&mousedev);
|
||||
}
|
||||
|
||||
DECL_GLOBAL_CONSTRUCTOR(mousedev_register) { dinput_register_device(&mousedev); }
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* SysMouseA (DInput Mouse support)
|
||||
*/
|
||||
|
@ -338,20 +349,16 @@ static ULONG WINAPI SysMouseAImpl_Release(LPDIRECTINPUTDEVICE8A iface)
|
|||
/* Free the data queue */
|
||||
HeapFree(GetProcessHeap(),0,This->data_queue);
|
||||
|
||||
#ifndef __REACTOS__
|
||||
|
||||
if (This->hook) {
|
||||
UnhookWindowsHookEx( This->hook );
|
||||
if (This->dwCoopLevel & DISCL_EXCLUSIVE)
|
||||
ShowCursor(TRUE); /* show cursor */
|
||||
}
|
||||
#ifndef __REACTOS__
|
||||
DeleteCriticalSection(&(This->crit));
|
||||
#endif
|
||||
|
||||
#ifdef __REACTOS__
|
||||
if (This->dwCoopLevel & DISCL_EXCLUSIVE)
|
||||
ShowCursor(TRUE); /* show cursor */
|
||||
|
||||
#endif
|
||||
/* Free the DataFormat */
|
||||
if (This->df != &(Wine_InternalMouseFormat)) {
|
||||
HeapFree(GetProcessHeap(), 0, This->df->rgodf);
|
||||
|
@ -436,7 +443,10 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara
|
|||
|
||||
if (code != HC_ACTION) return CallNextHookEx( This->hook, code, wparam, lparam );
|
||||
|
||||
#ifndef __REACTOS__
|
||||
EnterCriticalSection(&(This->crit));
|
||||
#endif
|
||||
|
||||
dwCoop = This->dwCoopLevel;
|
||||
|
||||
/* Only allow mouse events every 10 ms.
|
||||
|
@ -553,7 +563,9 @@ static LRESULT CALLBACK dinput_mouse_hook( int code, WPARAM wparam, LPARAM lpara
|
|||
This->m_state.rgbButtons[0], This->m_state.rgbButtons[2], This->m_state.rgbButtons[1]);
|
||||
|
||||
end:
|
||||
#ifndef __REACTOS__
|
||||
LeaveCriticalSection(&(This->crit));
|
||||
#endif
|
||||
|
||||
if (dwCoop & DISCL_NONEXCLUSIVE) {
|
||||
/* Pass the events down to previous handlers (e.g. win32 input) */
|
||||
|
@ -591,14 +603,15 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
{
|
||||
SysMouseImpl *This = (SysMouseImpl *)iface;
|
||||
RECT rect;
|
||||
POINT point;
|
||||
|
||||
TRACE("(this=%p)\n",This);
|
||||
|
||||
if (This->acquired)
|
||||
return S_FALSE;
|
||||
|
||||
This->acquired = 1;
|
||||
|
||||
if (This->acquired == 0) {
|
||||
POINT point;
|
||||
|
||||
|
||||
|
||||
/* Store (in a global variable) the current lock */
|
||||
current_lock = (IDirectInputDevice8A*)This;
|
||||
|
@ -623,9 +636,8 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
/* Install our mouse hook */
|
||||
if (This->dwCoopLevel & DISCL_EXCLUSIVE)
|
||||
ShowCursor(FALSE); /* hide cursor */
|
||||
#ifndef __REACTOS__
|
||||
|
||||
This->hook = SetWindowsHookExA( WH_MOUSE_LL, dinput_mouse_hook, DINPUT_instance, 0 );
|
||||
#endif
|
||||
|
||||
/* Get the window dimension and find the center */
|
||||
GetWindowRect(This->win, &rect);
|
||||
|
@ -646,7 +658,10 @@ static HRESULT WINAPI SysMouseAImpl_Acquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
#endif
|
||||
}
|
||||
|
||||
This->acquired = 1;
|
||||
return DI_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
|
@ -658,30 +673,20 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
|
||||
TRACE("(this=%p)\n",This);
|
||||
|
||||
if (0 == This->acquired) {
|
||||
return DI_NOEFFECT;
|
||||
}
|
||||
|
||||
if (This->acquired) {
|
||||
/* Reinstall previous mouse event handler */
|
||||
|
||||
|
||||
if (This->hook) {
|
||||
#ifndef __REACTOS__
|
||||
UnhookWindowsHookEx( This->hook );
|
||||
This->hook = 0;
|
||||
|
||||
if (This->dwCoopLevel & DISCL_EXCLUSIVE)
|
||||
ShowCursor(TRUE); /* show cursor */
|
||||
#endif
|
||||
#ifdef __REACTOS__
|
||||
if (This->dwCoopLevel & DISCL_EXCLUSIVE)
|
||||
ShowCursor(TRUE); /* show cursor */
|
||||
#endif
|
||||
}
|
||||
|
||||
/* No more locks */
|
||||
if (current_lock == (IDirectInputDevice8A*) This)
|
||||
current_lock = NULL;
|
||||
else
|
||||
ERR("this(%p) != current_lock(%p)\n", This, current_lock);
|
||||
|
||||
/* Unacquire device */
|
||||
This->acquired = 0;
|
||||
|
@ -691,6 +696,9 @@ static HRESULT WINAPI SysMouseAImpl_Unacquire(LPDIRECTINPUTDEVICE8A iface)
|
|||
TRACE(" warping mouse back to (%ld , %ld)\n", This->org_coords.x, This->org_coords.y);
|
||||
SetCursorPos(This->org_coords.x, This->org_coords.y);
|
||||
}
|
||||
} else {
|
||||
return DI_NOEFFECT;
|
||||
}
|
||||
|
||||
return DI_OK;
|
||||
}
|
||||
|
@ -781,15 +789,12 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceState(
|
|||
EnterCriticalSection(&(This->crit));
|
||||
#endif
|
||||
|
||||
#ifdef __REACTOS__
|
||||
getmousesvalue(iface);
|
||||
#endif
|
||||
TRACE("(this=%p,0x%08lx,%p): \n",This,len,ptr);
|
||||
|
||||
/* Copy the current mouse state */
|
||||
fill_DataFormat(ptr, &(This->m_state), This->wine_df);
|
||||
|
||||
|
||||
#ifdef __REACTOS__
|
||||
// this fix windows bugs when
|
||||
// some program calling on mouse poll
|
||||
if (poll_mouse==1) poll_mouse=0;
|
||||
|
@ -800,7 +805,7 @@ getmousesvalue(iface);
|
|||
This->m_state.lZ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* Check if we need to do a mouse warping */
|
||||
if (This->need_warp == WARP_NEEDED) {
|
||||
|
@ -843,168 +848,32 @@ static HRESULT WINAPI SysMouseAImpl_GetDeviceData(LPDIRECTINPUTDEVICE8A iface,
|
|||
SysMouseImpl *This = (SysMouseImpl *)iface;
|
||||
DWORD len;
|
||||
int nqtail;
|
||||
#ifdef __REACTOS__
|
||||
static int last_event=0;
|
||||
const int size = sizeof(DIDEVICEOBJECTDATA) * 1;
|
||||
int count=0;
|
||||
DWORD count_ent=0;
|
||||
static DWORD time=0;
|
||||
static POINT save_point;
|
||||
static int save_b[5];
|
||||
static int b[5];
|
||||
static POINT point;
|
||||
int calc;
|
||||
int count_button;
|
||||
int add = 0;
|
||||
#endif
|
||||
|
||||
|
||||
TRACE("(%p)->(dods=%ld,entries=%ld,fl=0x%08lx)\n",This,dodsize,*entries,flags);
|
||||
|
||||
#ifdef __REACTOS__
|
||||
|
||||
if (flags != DIGDD_PEEK)
|
||||
{
|
||||
b[0] = ((GetKeyState(VK_LBUTTON) & 0x80) ? 0xFF : 0x00);
|
||||
b[1] = ((GetKeyState(VK_RBUTTON) & 0x80) ? 0xFF : 0x00);
|
||||
b[2] = ((GetKeyState(VK_MBUTTON) & 0x80) ? 0xFF : 0x00);
|
||||
b[3] = ((GetKeyState(VK_XBUTTON1) & 0x80) ? 0xFF : 0x00);
|
||||
b[4] = ((GetKeyState(VK_XBUTTON2) & 0x80) ? 0xFF : 0x00);
|
||||
GetCursorPos( &point );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (This->acquired == 0) {
|
||||
WARN(" application tries to get data from an unacquired device !\n");
|
||||
return DIERR_NOTACQUIRED;
|
||||
//return DIERR_NOTACQUIRED;
|
||||
|
||||
// windows does not get any data if
|
||||
// we do not call manual to mouse Acquire
|
||||
// this is only need if some apps calling on getdevice data direcly
|
||||
// in windows GetdeviceData does always update first the data
|
||||
// then return it.
|
||||
SysMouseAImpl_Acquire(iface);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef __REACTOS__
|
||||
|
||||
|
||||
if (*entries == 0) return DIERR_INVALIDPARAM;
|
||||
|
||||
if (dodsize < sizeof(DIDEVICEOBJECTDATA_DX3)) {
|
||||
ERR("Wrong structure size !\n");
|
||||
return DIERR_INVALIDPARAM;
|
||||
}
|
||||
if (This->data_queue==NULL) {
|
||||
WARN("No buffer have been set up !\n");
|
||||
return DIERR_NOTINITIALIZED;
|
||||
}
|
||||
|
||||
/* this code are not need it but if we want 100% compatible
|
||||
with ms we should keep it. but the mouse will be choppy
|
||||
in Unreal 2004 Demo
|
||||
|
||||
if (GetTickCount()-time <50) {
|
||||
*entries=0;
|
||||
return DI_OK;
|
||||
}
|
||||
time = GetTickCount();
|
||||
*/
|
||||
if (GetTickCount()-time <50)
|
||||
{
|
||||
add=0;
|
||||
}
|
||||
else
|
||||
{
|
||||
add=1;
|
||||
time = GetTickCount();
|
||||
}
|
||||
|
||||
|
||||
for (count=0;count<*entries;count++) {
|
||||
|
||||
|
||||
if (save_point.x != point.x) {
|
||||
dod[count_ent].dwOfs = DIMOFS_X;
|
||||
|
||||
dod[count_ent].dwData = point.x - save_point.x;
|
||||
dod[count_ent].dwTimeStamp = GetTickCount();
|
||||
dod[count_ent].dwSequence = last_event+=add;
|
||||
count_ent++;
|
||||
save_point.x = point.x;
|
||||
}
|
||||
|
||||
else if (save_point.y != point.y) {
|
||||
dod[count_ent].dwOfs = DIMOFS_Y;
|
||||
dod[count_ent].dwData = point.y - save_point.y;
|
||||
|
||||
dod[count_ent].dwTimeStamp = GetTickCount();
|
||||
dod[count_ent].dwSequence = last_event+=add;
|
||||
count_ent++;
|
||||
save_point.y = point.y;
|
||||
}
|
||||
|
||||
else if (save_b[0] != b[0]) {
|
||||
dod[count_ent].dwOfs = DIMOFS_BUTTON0;
|
||||
|
||||
dod[count_ent].dwData = b[0];
|
||||
dod[count_ent].dwTimeStamp = GetTickCount();
|
||||
dod[count_ent].dwSequence = last_event+=add;
|
||||
count_ent++;
|
||||
save_b[0] = b[0];
|
||||
}
|
||||
|
||||
else if (save_b[1] != b[1]) {
|
||||
dod[count_ent].dwOfs = DIMOFS_BUTTON1;
|
||||
|
||||
dod[count_ent].dwData = b[1];
|
||||
dod[count_ent].dwTimeStamp = GetTickCount();
|
||||
dod[count_ent].dwSequence = last_event+=add;
|
||||
count_ent++;
|
||||
save_b[1] = b[1];
|
||||
}
|
||||
|
||||
else if (save_b[2] != b[2]) {
|
||||
dod[count_ent].dwOfs = DIMOFS_BUTTON2;
|
||||
|
||||
dod[count_ent].dwData = b[2];
|
||||
dod[count_ent].dwTimeStamp = GetTickCount();
|
||||
dod[count_ent].dwSequence = last_event+=add;
|
||||
count_ent++;
|
||||
save_b[2] = b[2];
|
||||
}
|
||||
|
||||
else if (save_b[3] != b[3]) {
|
||||
dod[count_ent].dwOfs = DIMOFS_BUTTON3;
|
||||
|
||||
dod[count_ent].dwData = b[3];
|
||||
dod[count_ent].dwTimeStamp = GetTickCount();
|
||||
dod[count_ent].dwSequence = last_event+=add;
|
||||
count_ent++;
|
||||
save_b[3] = b[3];
|
||||
}
|
||||
|
||||
|
||||
} // end for
|
||||
|
||||
|
||||
SetCursorPos(point.x, point.y);
|
||||
*entries = count_ent;
|
||||
#endif
|
||||
|
||||
#ifndef __REACTOS__
|
||||
EnterCriticalSection(&(This->crit));
|
||||
|
||||
#endif
|
||||
|
||||
// FIXME mouse are bit choppy here.
|
||||
|
||||
|
@ -1047,9 +916,9 @@ SetCursorPos(point.x, point.y);
|
|||
}
|
||||
if (!(flags & DIGDD_PEEK))
|
||||
This->queue_tail = nqtail;
|
||||
|
||||
#ifndef __REACTOS__
|
||||
LeaveCriticalSection(&(This->crit));
|
||||
|
||||
#endif
|
||||
/* Check if we need to do a mouse warping */
|
||||
|
||||
|
||||
|
@ -1067,7 +936,6 @@ SetCursorPos(point.x, point.y);
|
|||
This->need_warp = WARP_STARTED;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
return DI_OK;
|
||||
}
|
||||
|
||||
|
@ -1089,7 +957,8 @@ static HRESULT WINAPI SysMouseAImpl_SetProperty(LPDIRECTINPUTDEVICE8A iface,
|
|||
|
||||
TRACE("buffersize = %ld\n",pd->dwData);
|
||||
|
||||
This->data_queue = HeapAlloc(GetProcessHeap(),0, pd->dwData * sizeof(DIDEVICEOBJECTDATA));
|
||||
This->data_queue = (LPDIDEVICEOBJECTDATA)HeapAlloc(GetProcessHeap(),0,
|
||||
pd->dwData * sizeof(DIDEVICEOBJECTDATA));
|
||||
This->queue_head = 0;
|
||||
This->queue_tail = 0;
|
||||
This->queue_len = pd->dwData;
|
||||
|
@ -1120,7 +989,7 @@ static HRESULT WINAPI SysMouseAImpl_GetProperty(LPDIRECTINPUTDEVICE8A iface,
|
|||
{
|
||||
SysMouseImpl *This = (SysMouseImpl *)iface;
|
||||
|
||||
TRACE("(this=%p,%s,%p)\n",
|
||||
TRACE("(this=%p,%s,%p): stub!\n",
|
||||
iface, debugstr_guid(rguid), pdiph);
|
||||
|
||||
if (TRACE_ON(dinput))
|
||||
|
|
|
@ -3,6 +3,7 @@ TOPOBJDIR = ../..
|
|||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = dinput8.dll
|
||||
IMPORTLIB = libdinput8.$(IMPLIBEXT)
|
||||
IMPORTS = dinput
|
||||
EXTRALIBS = -luuid
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue