- Add missing svn:eol-style properties.

- Use consistent newline style.
- Update file COPYING.

svn path=/trunk/; revision=43817
This commit is contained in:
Dmitry Gorbachev 2009-10-28 20:13:23 +00:00
parent 008b7c72d8
commit c9c4571300
13 changed files with 803 additions and 804 deletions

View file

@ -1,13 +1,12 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
Version 2, June 1991 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
Preamble Preamble
The licenses for most software are designed to take away your The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public freedom to share and change it. By contrast, the GNU General Public
@ -16,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to the GNU Lesser General Public License instead.) You can apply it to
your programs, too. your programs, too.
When we speak of free software, we are referring to freedom, not When we speak of free software, we are referring to freedom, not
@ -56,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains 0. This License applies to any program or other work which contains
@ -111,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on does not normally print such an announcement, your work based on
the Program is not required to print an announcement.) the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program, identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in and can be reasonably considered independent and separate works in
@ -169,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not distribution of the source code, even though third parties are not
compelled to copy the source along with the object code. compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program 4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is otherwise to copy, modify, sublicense or distribute the Program is
@ -226,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License. be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in 8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License original copyright holder who places the Program under this License
@ -256,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally. of promoting the sharing and reuse of software generally.
NO WARRANTY NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@ -278,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES. POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it possible use to the public, the best way to achieve this is to make it
@ -292,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found. the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.> <one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author> Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -304,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License along
along with this program; if not, write to the Free Software with this program; if not, write to the Free Software Foundation, Inc.,
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this If the program is interactive, make it output a short notice like this
when it starts in an interactive mode: when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. under certain conditions; type `show c' for details.
@ -336,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. Public License instead of this License.

View file

@ -1,12 +1,12 @@
<module name="ddraw_test" type="win32cui" allowwarnings="false"> <module name="ddraw_test" type="win32cui" allowwarnings="false">
<include base="ddraw_test">.</include> <include base="ddraw_test">.</include>
<library>kernel32</library> <library>kernel32</library>
<library>user32</library> <library>user32</library>
<library>gdi32</library> <library>gdi32</library>
<library>ole32</library> <library>ole32</library>
<library>ddraw</library> <library>ddraw</library>
<library>dxguid</library> <library>dxguid</library>
<file>ddraw_test.cpp</file> <file>ddraw_test.cpp</file>
<file>helper.cpp</file> <file>helper.cpp</file>
<file>testlist.cpp</file> <file>testlist.cpp</file>
</module> </module>

View file

@ -1,45 +1,45 @@
#include <stdio.h> #include <stdio.h>
/* SDK/DDK/NDK Headers. */ /* SDK/DDK/NDK Headers. */
#include <windows.h> #include <windows.h>
#include <wingdi.h> #include <wingdi.h>
#include <winddi.h> #include <winddi.h>
#include <d3dnthal.h> #include <d3dnthal.h>
#include <dll/directx/d3d8thk.h> #include <dll/directx/d3d8thk.h>
#include <ddrawi.h> #include <ddrawi.h>
#include "test.h" #include "test.h"
/* /*
* Test see if we can delete a DirectDrawObject from win32k * Test see if we can delete a DirectDrawObject from win32k
* *
*/ */
void void
test_NtGdiDdCanCreateSurface(HANDLE hDirectDrawLocal) test_NtGdiDdCanCreateSurface(HANDLE hDirectDrawLocal)
{ {
int fails=0; int fails=0;
BOOL retValue=FALSE; BOOL retValue=FALSE;
DDHAL_CANCREATESURFACEDATA pCanCreateSurface; DDHAL_CANCREATESURFACEDATA pCanCreateSurface;
DDSURFACEDESC2 desc; DDSURFACEDESC2 desc;
RtlZeroMemory(&pCanCreateSurface,sizeof(DDHAL_CANCREATESURFACEDATA)); RtlZeroMemory(&pCanCreateSurface,sizeof(DDHAL_CANCREATESURFACEDATA));
RtlZeroMemory(&desc,sizeof(DDSURFACEDESC2)); RtlZeroMemory(&desc,sizeof(DDSURFACEDESC2));
/* crash in windows 2000 */ /* crash in windows 2000 */
retValue = OsThunkDdCanCreateSurface(NULL,NULL); retValue = OsThunkDdCanCreateSurface(NULL,NULL);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"1. NtGdiDdCanCreateSurface(NULL,NULL);\0"); testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"1. NtGdiDdCanCreateSurface(NULL,NULL);\0");
retValue = OsThunkDdCanCreateSurface(hDirectDrawLocal,NULL); retValue = OsThunkDdCanCreateSurface(hDirectDrawLocal,NULL);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"2. NtGdiDdCanCreateSurface(hDirectDrawLocal,NULL);\0"); testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"2. NtGdiDdCanCreateSurface(hDirectDrawLocal,NULL);\0");
retValue = OsThunkDdCanCreateSurface(hDirectDrawLocal,(PDD_CANCREATESURFACEDATA)&pCanCreateSurface); retValue = OsThunkDdCanCreateSurface(hDirectDrawLocal,(PDD_CANCREATESURFACEDATA)&pCanCreateSurface);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"3. NtGdiDdCanCreateSurface(hDirectDrawLocal,pCanCreateSurface);\0"); testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"3. NtGdiDdCanCreateSurface(hDirectDrawLocal,pCanCreateSurface);\0");
pCanCreateSurface.lpDDSurfaceDesc = (DDSURFACEDESC*)&desc; pCanCreateSurface.lpDDSurfaceDesc = (DDSURFACEDESC*)&desc;
desc.dwSize = sizeof(DDSURFACEDESC2); desc.dwSize = sizeof(DDSURFACEDESC2);
retValue = OsThunkDdCanCreateSurface(hDirectDrawLocal,(PDD_CANCREATESURFACEDATA)&pCanCreateSurface); retValue = OsThunkDdCanCreateSurface(hDirectDrawLocal,(PDD_CANCREATESURFACEDATA)&pCanCreateSurface);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"4. NtGdiDdCanCreateSurface(hDirectDrawLocal,pCanCreateSurface);\0"); testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"4. NtGdiDdCanCreateSurface(hDirectDrawLocal,pCanCreateSurface);\0");
} }

View file

@ -1,40 +1,40 @@
#include <stdio.h> #include <stdio.h>
/* SDK/DDK/NDK Headers. */ /* SDK/DDK/NDK Headers. */
#include <windows.h> #include <windows.h>
#include <wingdi.h> #include <wingdi.h>
#include <winddi.h> #include <winddi.h>
#include <d3dnthal.h> #include <d3dnthal.h>
#include <dll/directx/d3d8thk.h> #include <dll/directx/d3d8thk.h>
#include "test.h" #include "test.h"
/* /*
* Test see if we can delete a DirectDrawObject from win32k * Test see if we can delete a DirectDrawObject from win32k
* *
*/ */
void void
test_NtGdiDdGetScanLine(HANDLE hDirectDrawLocal) test_NtGdiDdGetScanLine(HANDLE hDirectDrawLocal)
{ {
int fails=0; int fails=0;
BOOL retValue=FALSE; BOOL retValue=FALSE;
DD_GETSCANLINEDATA puGetScanLineData; DD_GETSCANLINEDATA puGetScanLineData;
printf("Start testing of NtGdiDdGetScanLine\n"); printf("Start testing of NtGdiDdGetScanLine\n");
RtlZeroMemory(&puGetScanLineData,sizeof(DD_GETSCANLINEDATA)); RtlZeroMemory(&puGetScanLineData,sizeof(DD_GETSCANLINEDATA));
retValue = OsThunkDdGetScanLine(NULL,NULL); retValue = OsThunkDdGetScanLine(NULL,NULL);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"1. NtGdiDdGetScanLine(NULL,NULL);\0"); testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"1. NtGdiDdGetScanLine(NULL,NULL);\0");
retValue = OsThunkDdGetScanLine(hDirectDrawLocal,NULL); retValue = OsThunkDdGetScanLine(hDirectDrawLocal,NULL);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"2. NtGdiDdGetScanLine(hDirectDrawLocal,NULL);\0"); testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"2. NtGdiDdGetScanLine(hDirectDrawLocal,NULL);\0");
puGetScanLineData.ddRVal = DDERR_GENERIC; puGetScanLineData.ddRVal = DDERR_GENERIC;
retValue = OsThunkDdGetScanLine(hDirectDrawLocal,&puGetScanLineData); retValue = OsThunkDdGetScanLine(hDirectDrawLocal,&puGetScanLineData);
testing_eq(retValue,DDHAL_DRIVER_NOTHANDLED,fails,"3. NtGdiDdGetScanLine(hDirectDrawLocal,puGetScanLineData);\0"); testing_eq(retValue,DDHAL_DRIVER_NOTHANDLED,fails,"3. NtGdiDdGetScanLine(hDirectDrawLocal,puGetScanLineData);\0");
testing_noteq(puGetScanLineData.ddRVal,DD_OK,fails,"4. NtGdiDdGetScanLine(hDirectDrawLocal,puGetScanLineData);\0"); testing_noteq(puGetScanLineData.ddRVal,DD_OK,fails,"4. NtGdiDdGetScanLine(hDirectDrawLocal,puGetScanLineData);\0");
testing_eq(puGetScanLineData.dwScanLine,0,fails,"4. NtGdiDdGetScanLine(hDirectDrawLocal,puGetScanLineData);\0"); testing_eq(puGetScanLineData.dwScanLine,0,fails,"4. NtGdiDdGetScanLine(hDirectDrawLocal,puGetScanLineData);\0");
/* FIXME DDERR_VERTICALBLANKINPROGRESS test */ /* FIXME DDERR_VERTICALBLANKINPROGRESS test */
show_status(fails, "NtGdiDdGetScanLine\0"); show_status(fails, "NtGdiDdGetScanLine\0");
} }

View file

@ -1,46 +1,46 @@
#include <stdio.h> #include <stdio.h>
/* SDK/DDK/NDK Headers. */ /* SDK/DDK/NDK Headers. */
#include <windows.h> #include <windows.h>
#include <wingdi.h> #include <wingdi.h>
#include <winddi.h> #include <winddi.h>
#include <d3dnthal.h> #include <d3dnthal.h>
#include <dll/directx/d3d8thk.h> #include <dll/directx/d3d8thk.h>
#include <ddrawi.h> #include <ddrawi.h>
#include "test.h" #include "test.h"
/* /*
* Test see if we can delete a DirectDrawObject from win32k * Test see if we can delete a DirectDrawObject from win32k
* *
*/ */
void void
test_NtGdiDdWaitForVerticalBlank(HANDLE hDirectDrawLocal) test_NtGdiDdWaitForVerticalBlank(HANDLE hDirectDrawLocal)
{ {
int fails=0; int fails=0;
BOOL retValue=FALSE; BOOL retValue=FALSE;
DDHAL_WAITFORVERTICALBLANKDATA pDdWaitForVerticalBlankData; DDHAL_WAITFORVERTICALBLANKDATA pDdWaitForVerticalBlankData;
RtlZeroMemory(&pDdWaitForVerticalBlankData,sizeof(DDHAL_WAITFORVERTICALBLANKDATA)); RtlZeroMemory(&pDdWaitForVerticalBlankData,sizeof(DDHAL_WAITFORVERTICALBLANKDATA));
retValue = OsThunkDdWaitForVerticalBlank(NULL,NULL); retValue = OsThunkDdWaitForVerticalBlank(NULL,NULL);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"1. NtGdiDdWaitForVerticalBlank(NULL,NULL);\0"); testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"1. NtGdiDdWaitForVerticalBlank(NULL,NULL);\0");
retValue = OsThunkDdWaitForVerticalBlank(hDirectDrawLocal,NULL); retValue = OsThunkDdWaitForVerticalBlank(hDirectDrawLocal,NULL);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"2. NtGdiDdWaitForVerticalBlank(hDirectDrawLocal,NULL);\0"); testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"2. NtGdiDdWaitForVerticalBlank(hDirectDrawLocal,NULL);\0");
retValue = OsThunkDdWaitForVerticalBlank(hDirectDrawLocal,(PDD_WAITFORVERTICALBLANKDATA)&pDdWaitForVerticalBlankData); retValue = OsThunkDdWaitForVerticalBlank(hDirectDrawLocal,(PDD_WAITFORVERTICALBLANKDATA)&pDdWaitForVerticalBlankData);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"3. NtGdiDdWaitForVerticalBlank(hDirectDrawLocal,NULL);\0"); testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"3. NtGdiDdWaitForVerticalBlank(hDirectDrawLocal,NULL);\0");
testing_eq(pDdWaitForVerticalBlankData.ddRVal, DD_OK,fails,"4. NtGdiDdWaitForVerticalBlank(hDirectDrawLocal,NULL);\0"); testing_eq(pDdWaitForVerticalBlankData.ddRVal, DD_OK,fails,"4. NtGdiDdWaitForVerticalBlank(hDirectDrawLocal,NULL);\0");
RtlZeroMemory(&pDdWaitForVerticalBlankData,sizeof(DDHAL_WAITFORVERTICALBLANKDATA)); RtlZeroMemory(&pDdWaitForVerticalBlankData,sizeof(DDHAL_WAITFORVERTICALBLANKDATA));
pDdWaitForVerticalBlankData.dwFlags = DDWAITVB_I_TESTVB; pDdWaitForVerticalBlankData.dwFlags = DDWAITVB_I_TESTVB;
retValue = OsThunkDdWaitForVerticalBlank(hDirectDrawLocal,(PDD_WAITFORVERTICALBLANKDATA)&pDdWaitForVerticalBlankData); retValue = OsThunkDdWaitForVerticalBlank(hDirectDrawLocal,(PDD_WAITFORVERTICALBLANKDATA)&pDdWaitForVerticalBlankData);
testing_eq(retValue, DDHAL_DRIVER_NOTHANDLED,fails,"5. NtGdiDdWaitForVerticalBlank(hDirectDrawLocal,NULL);\0"); testing_eq(retValue, DDHAL_DRIVER_NOTHANDLED,fails,"5. NtGdiDdWaitForVerticalBlank(hDirectDrawLocal,NULL);\0");
testing_noteq(pDdWaitForVerticalBlankData.ddRVal, DD_OK,fails,"6. NtGdiDdWaitForVerticalBlank(hDirectDrawLocal,NULL);\0"); testing_noteq(pDdWaitForVerticalBlankData.ddRVal, DD_OK,fails,"6. NtGdiDdWaitForVerticalBlank(hDirectDrawLocal,NULL);\0");
retValue = OsThunkDdWaitForVerticalBlank(hDirectDrawLocal,(PDD_WAITFORVERTICALBLANKDATA)&pDdWaitForVerticalBlankData); retValue = OsThunkDdWaitForVerticalBlank(hDirectDrawLocal,(PDD_WAITFORVERTICALBLANKDATA)&pDdWaitForVerticalBlankData);
show_status(fails, "NtGdiDdWaitForVerticalBlank\0"); show_status(fails, "NtGdiDdWaitForVerticalBlank\0");
} }

View file

@ -1,9 +1,9 @@
<module name="Imagelistviewer" type="win32gui" installbase="bin" installname="Imagelistviewer.exe"> <module name="Imagelistviewer" type="win32gui" installbase="bin" installname="Imagelistviewer.exe">
<include base="Imagelistviewer">.</include> <include base="Imagelistviewer">.</include>
<library>kernel32</library> <library>kernel32</library>
<library>user32</library> <library>user32</library>
<library>setupapi</library> <library>setupapi</library>
<library>comctl32</library> <library>comctl32</library>
<file>main.c</file> <file>main.c</file>
<file>res.rc</file> <file>res.rc</file>
</module> </module>

View file

@ -1,146 +1,146 @@
#include <windows.h> #include <windows.h>
#include <setupapi.h> #include <setupapi.h>
#include <tchar.h> #include <tchar.h>
#include <stdlib.h> #include <stdlib.h>
#include "resource.h" #include "resource.h"
typedef BOOL (WINAPI * SH_GIL_PROC)(HIMAGELIST *phLarge, HIMAGELIST *phSmall); typedef BOOL (WINAPI * SH_GIL_PROC)(HIMAGELIST *phLarge, HIMAGELIST *phSmall);
typedef BOOL (WINAPI * FII_PROC)(BOOL fFullInit); typedef BOOL (WINAPI * FII_PROC)(BOOL fFullInit);
/*** Shell32 undoc'd functions ***/ /*** Shell32 undoc'd functions ***/
/* Shell_GetImageLists @71 */ /* Shell_GetImageLists @71 */
/* FileIconInit @660 */ /* FileIconInit @660 */
BOOL BOOL
DisplayImageList(HWND hwnd, DisplayImageList(HWND hwnd,
UINT uID) UINT uID)
{ {
HWND hLV; HWND hLV;
SP_CLASSIMAGELIST_DATA ImageListData; SP_CLASSIMAGELIST_DATA ImageListData;
LV_ITEM lvItem; LV_ITEM lvItem;
TCHAR Buf[6]; TCHAR Buf[6];
INT ImageListCount = -1; INT ImageListCount = -1;
INT i = 0; INT i = 0;
hLV = GetDlgItem(hwnd, IDC_LSTVIEW); hLV = GetDlgItem(hwnd, IDC_LSTVIEW);
(void)ListView_DeleteAllItems(hLV); (void)ListView_DeleteAllItems(hLV);
if (uID == IDC_SYSTEM) if (uID == IDC_SYSTEM)
{ {
HIMAGELIST hLarge, hSmall; HIMAGELIST hLarge, hSmall;
HMODULE hShell32; HMODULE hShell32;
SH_GIL_PROC Shell_GetImageLists; SH_GIL_PROC Shell_GetImageLists;
FII_PROC FileIconInit; FII_PROC FileIconInit;
hShell32 = LoadLibrary(_T("shell32.dll")); hShell32 = LoadLibrary(_T("shell32.dll"));
if(hShell32 == NULL) if(hShell32 == NULL)
return FALSE; return FALSE;
Shell_GetImageLists = (SH_GIL_PROC)GetProcAddress(hShell32, (LPCSTR)71); Shell_GetImageLists = (SH_GIL_PROC)GetProcAddress(hShell32, (LPCSTR)71);
FileIconInit = (FII_PROC)GetProcAddress(hShell32, (LPCSTR)660); FileIconInit = (FII_PROC)GetProcAddress(hShell32, (LPCSTR)660);
if(Shell_GetImageLists == NULL || FileIconInit == NULL) if(Shell_GetImageLists == NULL || FileIconInit == NULL)
{ {
FreeLibrary(hShell32); FreeLibrary(hShell32);
return FALSE; return FALSE;
} }
FileIconInit(TRUE); FileIconInit(TRUE);
Shell_GetImageLists(&hLarge, &hSmall); Shell_GetImageLists(&hLarge, &hSmall);
ImageListCount = ImageList_GetImageCount(hSmall); ImageListCount = ImageList_GetImageCount(hSmall);
(void)ListView_SetImageList(hLV, (void)ListView_SetImageList(hLV,
hSmall, hSmall,
LVSIL_SMALL); LVSIL_SMALL);
FreeLibrary(hShell32); FreeLibrary(hShell32);
} }
else if (uID == IDC_DEVICE) else if (uID == IDC_DEVICE)
{ {
ImageListData.cbSize = sizeof(SP_CLASSIMAGELIST_DATA); ImageListData.cbSize = sizeof(SP_CLASSIMAGELIST_DATA);
SetupDiGetClassImageList(&ImageListData); SetupDiGetClassImageList(&ImageListData);
ImageListCount = ImageList_GetImageCount(ImageListData.ImageList); ImageListCount = ImageList_GetImageCount(ImageListData.ImageList);
(void)ListView_SetImageList(hLV, (void)ListView_SetImageList(hLV,
ImageListData.ImageList, ImageListData.ImageList,
LVSIL_SMALL); LVSIL_SMALL);
} }
else else
return FALSE; return FALSE;
lvItem.mask = LVIF_TEXT | LVIF_IMAGE; lvItem.mask = LVIF_TEXT | LVIF_IMAGE;
while (i <= ImageListCount) while (i <= ImageListCount)
{ {
lvItem.iItem = i; lvItem.iItem = i;
lvItem.iSubItem = 0; lvItem.iSubItem = 0;
lvItem.pszText = _itot(i, Buf, 10); lvItem.pszText = _itot(i, Buf, 10);
lvItem.iImage = i; lvItem.iImage = i;
(void)ListView_InsertItem(hLV, &lvItem); (void)ListView_InsertItem(hLV, &lvItem);
i++; i++;
} }
return TRUE; return TRUE;
} }
BOOL CALLBACK BOOL CALLBACK
DlgProc(HWND hwnd, DlgProc(HWND hwnd,
UINT message, UINT message,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
switch (message) switch (message)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
DisplayImageList(hwnd, IDC_SYSTEM); DisplayImageList(hwnd, IDC_SYSTEM);
return TRUE; return TRUE;
case WM_CLOSE: case WM_CLOSE:
EndDialog(hwnd, 0); EndDialog(hwnd, 0);
return TRUE; return TRUE;
case WM_COMMAND: case WM_COMMAND:
{ {
switch(LOWORD(wParam)) switch(LOWORD(wParam))
{ {
case IDOK: case IDOK:
EndDialog(hwnd, 0); EndDialog(hwnd, 0);
return TRUE; return TRUE;
case IDC_SYSTEM: case IDC_SYSTEM:
DisplayImageList(hwnd, IDC_SYSTEM); DisplayImageList(hwnd, IDC_SYSTEM);
return TRUE; return TRUE;
case IDC_DEVICE: case IDC_DEVICE:
DisplayImageList(hwnd, IDC_DEVICE); DisplayImageList(hwnd, IDC_DEVICE);
return TRUE; return TRUE;
} }
} }
} }
return FALSE; return FALSE;
} }
int WINAPI int WINAPI
WinMain(HINSTANCE hThisInstance, WinMain(HINSTANCE hThisInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
LPSTR lpszArgument, LPSTR lpszArgument,
int nCmdShow) int nCmdShow)
{ {
INITCOMMONCONTROLSEX icex; INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(INITCOMMONCONTROLSEX); icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES; icex.dwICC = ICC_BAR_CLASSES | ICC_COOL_CLASSES;
InitCommonControlsEx(&icex); InitCommonControlsEx(&icex);
return DialogBox(hThisInstance, return DialogBox(hThisInstance,
MAKEINTRESOURCE(IDD_IMGLST), MAKEINTRESOURCE(IDD_IMGLST),
NULL, NULL,
(DLGPROC)DlgProc); (DLGPROC)DlgProc);
} }

View file

@ -1,4 +1,4 @@
#define IDD_IMGLST 1000 #define IDD_IMGLST 1000
#define IDC_LSTVIEW 1001 #define IDC_LSTVIEW 1001
#define IDC_SYSTEM 1002 #define IDC_SYSTEM 1002
#define IDC_DEVICE 1003 #define IDC_DEVICE 1003

View file

@ -1,33 +1,33 @@
#include <stdio.h> #include <stdio.h>
#include <tchar.h> #include <tchar.h>
#include <windows.h> #include <windows.h>
int main() int main()
{ {
TCHAR Buffer = 0; TCHAR Buffer = 0;
DWORD Count = 0; DWORD Count = 0;
// //
// We clear the mode, most importantly turn off ENABLE_ECHO_INPUT and ENABLE_LINE_INPUT // We clear the mode, most importantly turn off ENABLE_ECHO_INPUT and ENABLE_LINE_INPUT
// This is the same mode as that is set up by getch() when trying to get a char // This is the same mode as that is set up by getch() when trying to get a char
// //
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),0); SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),0);
// //
// We read one char from the input and then return // We read one char from the input and then return
// //
ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&Buffer,1,&Count,NULL); ReadConsole(GetStdHandle(STD_INPUT_HANDLE),&Buffer,1,&Count,NULL);
// //
// We print out this char as an int to show that infact a backspace does count as input // We print out this char as an int to show that infact a backspace does count as input
// //
_tprintf(TEXT("You printed %c :: "), Buffer); _tprintf(TEXT("You printed %c :: "), Buffer);
_tprintf(TEXT("With a value %d :: "), Buffer); _tprintf(TEXT("With a value %d :: "), Buffer);
_tprintf(TEXT("Number of chars recieved %lu :: "), Count); _tprintf(TEXT("Number of chars recieved %lu :: "), Count);
_tprintf(TEXT("Char equal to backspace %d \n"), (Buffer == TEXT('\b'))); _tprintf(TEXT("Char equal to backspace %d \n"), (Buffer == TEXT('\b')));
// //
// :) // :)
// //
return 0; return 0;
} }

View file

@ -1,387 +1,387 @@
/* /*
* PROJECT: ReactOS * PROJECT: ReactOS
* LICENSE: GPL - See COPYING in the top level directory * LICENSE: GPL - See COPYING in the top level directory
* FILE: base/applications/testset/user32/kbdlayout/kbdlayout.c * FILE: base/applications/testset/user32/kbdlayout/kbdlayout.c
* PURPOSE: Keyboard layout testapp * PURPOSE: Keyboard layout testapp
* COPYRIGHT: Copyright 2007 Saveliy Tretiakov * COPYRIGHT: Copyright 2007 Saveliy Tretiakov
*/ */
#define UNICODE #define UNICODE
#include<wchar.h> #include<wchar.h>
#include <windows.h> #include <windows.h>
#include "resource.h" #include "resource.h"
LRESULT MainDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam); LRESULT MainDialogProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
HINSTANCE hInst; HINSTANCE hInst;
HWND hMainDlg; HWND hMainDlg;
typedef struct { typedef struct {
WNDPROC OrigProc; WNDPROC OrigProc;
WCHAR WndName[25]; WCHAR WndName[25];
} WND_DATA; } WND_DATA;
DWORD WINAPI ThreadProc(LPVOID lpParam) DWORD WINAPI ThreadProc(LPVOID lpParam)
{ {
DialogBoxParam(hInst, DialogBoxParam(hInst,
MAKEINTRESOURCE(IDD_MAINDIALOG), MAKEINTRESOURCE(IDD_MAINDIALOG),
NULL, NULL,
(DLGPROC)MainDialogProc, (DLGPROC)MainDialogProc,
(LPARAM)NULL); (LPARAM)NULL);
return 0; return 0;
} }
INT WINAPI WinMain(HINSTANCE hInstance, INT WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, LPSTR lpCmdLine,
int nCmdShow) int nCmdShow)
{ {
hInst = hInstance; hInst = hInstance;
ThreadProc(0); ThreadProc(0);
return 0; return 0;
} }
int GetKlList(HKL **list) int GetKlList(HKL **list)
{ {
HKL *ret; HKL *ret;
int n; int n;
n = GetKeyboardLayoutList(0, NULL); n = GetKeyboardLayoutList(0, NULL);
ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HKL)*n); ret = HeapAlloc(GetProcessHeap(), 0, sizeof(HKL)*n);
GetKeyboardLayoutList(n, ret); GetKeyboardLayoutList(n, ret);
*list = ret; *list = ret;
return n; return n;
} }
void FreeKlList(HKL *list) void FreeKlList(HKL *list)
{ {
HeapFree(GetProcessHeap(), 0, list); HeapFree(GetProcessHeap(), 0, list);
} }
void UpdateData(HWND hDlg) void UpdateData(HWND hDlg)
{ {
WCHAR buf[KL_NAMELENGTH]; WCHAR buf[KL_NAMELENGTH];
WCHAR buf2[512]; WCHAR buf2[512];
HWND hList; HWND hList;
HKL *klList, hKl; HKL *klList, hKl;
int n, i,j; int n, i,j;
GetKeyboardLayoutName(buf); GetKeyboardLayoutName(buf);
swprintf(buf2, L"Active: %s (%x)", buf, GetKeyboardLayout(0)); swprintf(buf2, L"Active: %s (%x)", buf, GetKeyboardLayout(0));
SetWindowText(GetDlgItem(hDlg, IDC_ACTIVE), buf2); SetWindowText(GetDlgItem(hDlg, IDC_ACTIVE), buf2);
hList = GetDlgItem(hDlg, IDC_LIST); hList = GetDlgItem(hDlg, IDC_LIST);
SendMessage(hList, LB_RESETCONTENT, 0, 0); SendMessage(hList, LB_RESETCONTENT, 0, 0);
n = GetKlList(&klList); n = GetKlList(&klList);
hKl = GetKeyboardLayout(0); hKl = GetKeyboardLayout(0);
for(i = 0; i < n; i++) for(i = 0; i < n; i++)
{ {
swprintf(buf, L"%x", klList[i] ); swprintf(buf, L"%x", klList[i] );
j = SendMessage(hList, LB_ADDSTRING, 0, (LPARAM) buf); j = SendMessage(hList, LB_ADDSTRING, 0, (LPARAM) buf);
SendMessage(hList, LB_SETITEMDATA, j, (LPARAM) klList[i]); SendMessage(hList, LB_SETITEMDATA, j, (LPARAM) klList[i]);
if(klList[i] == hKl) SendMessage(hList, LB_SETCURSEL, j, 0); if(klList[i] == hKl) SendMessage(hList, LB_SETCURSEL, j, 0);
} }
FreeKlList(klList); FreeKlList(klList);
} }
void FormatMsg(WCHAR *format, ...) void FormatMsg(WCHAR *format, ...)
{ {
WCHAR buf[255]; WCHAR buf[255];
va_list argptr; va_list argptr;
va_start(argptr, format); va_start(argptr, format);
_vsnwprintf(buf, sizeof(buf)-1, format, argptr); _vsnwprintf(buf, sizeof(buf)-1, format, argptr);
MessageBox(0, buf, L"msg", 0); MessageBox(0, buf, L"msg", 0);
va_end(argptr); va_end(argptr);
} }
void FormatBox(HWND hWnd, DWORD Flags, WCHAR *Caption, WCHAR *Format, ...) void FormatBox(HWND hWnd, DWORD Flags, WCHAR *Caption, WCHAR *Format, ...)
{ {
WCHAR buf[255]; WCHAR buf[255];
va_list argptr; va_list argptr;
va_start(argptr, Format); va_start(argptr, Format);
_vsnwprintf(buf, sizeof(buf)-1, Format, argptr); _vsnwprintf(buf, sizeof(buf)-1, Format, argptr);
MessageBox(hWnd, buf, Caption, Flags); MessageBox(hWnd, buf, Caption, Flags);
va_end(argptr); va_end(argptr);
} }
LRESULT CALLBACK WndSubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK WndSubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
WND_DATA *data = (WND_DATA*)GetWindowLong(hwnd, GWL_USERDATA); WND_DATA *data = (WND_DATA*)GetWindowLong(hwnd, GWL_USERDATA);
if(uMsg == WM_INPUTLANGCHANGE) if(uMsg == WM_INPUTLANGCHANGE)
{ {
FormatMsg(L"%s: WM_INPUTLANGCHANGE lParam=%x wParam=%x\n", data->WndName, lParam, wParam); FormatMsg(L"%s: WM_INPUTLANGCHANGE lParam=%x wParam=%x\n", data->WndName, lParam, wParam);
UpdateData(hMainDlg); UpdateData(hMainDlg);
//Pass message to defwindowproc //Pass message to defwindowproc
} }
else if(uMsg == WM_INPUTLANGCHANGEREQUEST) else if(uMsg == WM_INPUTLANGCHANGEREQUEST)
{ {
FormatMsg(L"%s: WM_INPUTLANGCHANGEREQUEST lParam=%x wParam=%x\n", data->WndName, lParam, wParam); FormatMsg(L"%s: WM_INPUTLANGCHANGEREQUEST lParam=%x wParam=%x\n", data->WndName, lParam, wParam);
UpdateData(hMainDlg); UpdateData(hMainDlg);
//Pass message to defwindowproc //Pass message to defwindowproc
} }
return ( CallWindowProc( data->OrigProc, hwnd, uMsg, wParam, lParam) ); return ( CallWindowProc( data->OrigProc, hwnd, uMsg, wParam, lParam) );
} }
void SubclassWnd(HWND hWnd, WCHAR* Name) void SubclassWnd(HWND hWnd, WCHAR* Name)
{ {
WND_DATA *data = HeapAlloc(GetProcessHeap(), 0, sizeof(WND_DATA)); WND_DATA *data = HeapAlloc(GetProcessHeap(), 0, sizeof(WND_DATA));
data->OrigProc = (WNDPROC)SetWindowLong( hWnd, GWL_WNDPROC, (LONG)WndSubclassProc); data->OrigProc = (WNDPROC)SetWindowLong( hWnd, GWL_WNDPROC, (LONG)WndSubclassProc);
wcsncpy(data->WndName, Name, 25); wcsncpy(data->WndName, Name, 25);
SetWindowLong(hWnd, GWL_USERDATA, (LONG)data); SetWindowLong(hWnd, GWL_USERDATA, (LONG)data);
return; return;
} }
DWORD GetActivateFlags(HWND hDlg) DWORD GetActivateFlags(HWND hDlg)
{ {
DWORD ret = 0; DWORD ret = 0;
if(IsDlgButtonChecked(hDlg, IDC_KLF_REORDER)) if(IsDlgButtonChecked(hDlg, IDC_KLF_REORDER))
ret |= KLF_REORDER; ret |= KLF_REORDER;
if(IsDlgButtonChecked(hDlg, IDC_KLF_RESET)) if(IsDlgButtonChecked(hDlg, IDC_KLF_RESET))
ret |= KLF_RESET; ret |= KLF_RESET;
if(IsDlgButtonChecked(hDlg, IDC_KLF_SHIFTLOCK)) if(IsDlgButtonChecked(hDlg, IDC_KLF_SHIFTLOCK))
ret |= KLF_SHIFTLOCK; ret |= KLF_SHIFTLOCK;
if(IsDlgButtonChecked(hDlg, IDC_KLF_SETFORPROCESS)) if(IsDlgButtonChecked(hDlg, IDC_KLF_SETFORPROCESS))
ret |= KLF_SETFORPROCESS; ret |= KLF_SETFORPROCESS;
return ret; return ret;
} }
DWORD GetLoadFlags(HWND hDlg) DWORD GetLoadFlags(HWND hDlg)
{ {
DWORD ret = 0; DWORD ret = 0;
if(IsDlgButtonChecked(hDlg, IDL_KLF_ACTIVATE)) if(IsDlgButtonChecked(hDlg, IDL_KLF_ACTIVATE))
ret |= KLF_ACTIVATE; ret |= KLF_ACTIVATE;
if(IsDlgButtonChecked(hDlg, IDL_KLF_NOTELLSHELL)) if(IsDlgButtonChecked(hDlg, IDL_KLF_NOTELLSHELL))
ret |= KLF_NOTELLSHELL; ret |= KLF_NOTELLSHELL;
if(IsDlgButtonChecked(hDlg, IDL_KLF_REORDER)) if(IsDlgButtonChecked(hDlg, IDL_KLF_REORDER))
ret |= KLF_REORDER; ret |= KLF_REORDER;
if(IsDlgButtonChecked(hDlg, IDL_KLF_REPLACELANG)) if(IsDlgButtonChecked(hDlg, IDL_KLF_REPLACELANG))
ret |= KLF_REPLACELANG; ret |= KLF_REPLACELANG;
if(IsDlgButtonChecked(hDlg, IDL_KLF_SUBSTITUTE_OK)) if(IsDlgButtonChecked(hDlg, IDL_KLF_SUBSTITUTE_OK))
ret |= KLF_SUBSTITUTE_OK; ret |= KLF_SUBSTITUTE_OK;
if(IsDlgButtonChecked(hDlg, IDL_KLF_SETFORPROCESS)) if(IsDlgButtonChecked(hDlg, IDL_KLF_SETFORPROCESS))
ret |= KLF_SETFORPROCESS; ret |= KLF_SETFORPROCESS;
return ret; return ret;
} }
UINT GetDelayMilliseconds(HWND hDlg) UINT GetDelayMilliseconds(HWND hDlg)
{ {
WCHAR Buf[255]; WCHAR Buf[255];
UINT ret; UINT ret;
GetWindowText(GetDlgItem(hDlg, IDC_DELAY), Buf, sizeof(Buf)); GetWindowText(GetDlgItem(hDlg, IDC_DELAY), Buf, sizeof(Buf));
swscanf(Buf, L"%d", &ret); swscanf(Buf, L"%d", &ret);
return ret*1000; return ret*1000;
} }
HKL GetSelectedLayout(HWND hDlg) HKL GetSelectedLayout(HWND hDlg)
{ {
int n; int n;
HWND hList; HWND hList;
hList = GetDlgItem(hDlg, IDC_LIST); hList = GetDlgItem(hDlg, IDC_LIST);
if((n = SendMessage(hList, LB_GETCURSEL, 0, 0)) != LB_ERR) if((n = SendMessage(hList, LB_GETCURSEL, 0, 0)) != LB_ERR)
return (HKL) SendMessage(hList, LB_GETITEMDATA, n, 0); return (HKL) SendMessage(hList, LB_GETITEMDATA, n, 0);
else return INVALID_HANDLE_VALUE; else return INVALID_HANDLE_VALUE;
} }
HKL GetActivateHandle(HWND hDlg) HKL GetActivateHandle(HWND hDlg)
{ {
if(IsDlgButtonChecked(hDlg, IDC_FROMLIST)) if(IsDlgButtonChecked(hDlg, IDC_FROMLIST))
return GetSelectedLayout(hDlg); return GetSelectedLayout(hDlg);
else if(IsDlgButtonChecked(hDlg, IDC_HKL_NEXT)) else if(IsDlgButtonChecked(hDlg, IDC_HKL_NEXT))
return (HKL)HKL_NEXT; return (HKL)HKL_NEXT;
return (HKL)HKL_PREV; return (HKL)HKL_PREV;
} }
/*************************************************** /***************************************************
* MainDialogProc * * MainDialogProc *
***************************************************/ ***************************************************/
LRESULT MainDialogProc(HWND hDlg, LRESULT MainDialogProc(HWND hDlg,
UINT Msg, UINT Msg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
HKL hKl; HKL hKl;
switch (Msg) switch (Msg)
{ {
case WM_INITDIALOG: case WM_INITDIALOG:
{ {
WCHAR Buf[255]; WCHAR Buf[255];
UpdateData(hDlg); UpdateData(hDlg);
hMainDlg = hDlg; hMainDlg = hDlg;
SubclassWnd(GetDlgItem(hDlg, IDC_LIST), L"List"); SubclassWnd(GetDlgItem(hDlg, IDC_LIST), L"List");
SubclassWnd(GetDlgItem(hDlg, IDC_EDIT1), L"Edit1"); SubclassWnd(GetDlgItem(hDlg, IDC_EDIT1), L"Edit1");
SubclassWnd(GetDlgItem(hDlg, IDC_KLID), L"Klid"); SubclassWnd(GetDlgItem(hDlg, IDC_KLID), L"Klid");
SubclassWnd(GetDlgItem(hDlg, ID_CANCEL), L"CancelB"); SubclassWnd(GetDlgItem(hDlg, ID_CANCEL), L"CancelB");
SubclassWnd(GetDlgItem(hDlg, IDC_ACTIVATE), L"ActivateB"); SubclassWnd(GetDlgItem(hDlg, IDC_ACTIVATE), L"ActivateB");
SubclassWnd(GetDlgItem(hDlg, IDC_REFRESH), L"RefreshB"); SubclassWnd(GetDlgItem(hDlg, IDC_REFRESH), L"RefreshB");
SubclassWnd(GetDlgItem(hDlg, IDC_UNLOAD), L"UnloadB"); SubclassWnd(GetDlgItem(hDlg, IDC_UNLOAD), L"UnloadB");
SubclassWnd(GetDlgItem(hDlg, IDC_LOAD), L"LoadB"); SubclassWnd(GetDlgItem(hDlg, IDC_LOAD), L"LoadB");
CheckRadioButton(hDlg, IDC_FROMLIST, IDC_FROMEDIT, IDC_FROMLIST); CheckRadioButton(hDlg, IDC_FROMLIST, IDC_FROMEDIT, IDC_FROMLIST);
SetWindowText(GetDlgItem(hDlg, IDC_KLID), L"00000419"); SetWindowText(GetDlgItem(hDlg, IDC_KLID), L"00000419");
swprintf(Buf, L"Current thread id: %d", GetCurrentThreadId()); swprintf(Buf, L"Current thread id: %d", GetCurrentThreadId());
SetWindowText(GetDlgItem(hDlg, IDC_CURTHREAD), Buf); SetWindowText(GetDlgItem(hDlg, IDC_CURTHREAD), Buf);
SetWindowText(GetDlgItem(hDlg, IDC_DELAY), L"0"); SetWindowText(GetDlgItem(hDlg, IDC_DELAY), L"0");
return 0; return 0;
} /* WM_INITDIALOG */ } /* WM_INITDIALOG */
case WM_COMMAND: case WM_COMMAND:
{ {
switch(LOWORD(wParam)) switch(LOWORD(wParam))
{ {
case ID_CANCEL: case ID_CANCEL:
{ {
EndDialog(hDlg, ERROR_CANCELLED); EndDialog(hDlg, ERROR_CANCELLED);
break; break;
} }
case IDC_ACTIVATE: case IDC_ACTIVATE:
{ {
if((hKl = GetActivateHandle(hDlg)) != INVALID_HANDLE_VALUE) if((hKl = GetActivateHandle(hDlg)) != INVALID_HANDLE_VALUE)
{ {
Sleep(GetDelayMilliseconds(hDlg)); Sleep(GetDelayMilliseconds(hDlg));
if(!(hKl = ActivateKeyboardLayout(hKl, GetActivateFlags(hDlg)))) if(!(hKl = ActivateKeyboardLayout(hKl, GetActivateFlags(hDlg))))
FormatBox(hDlg, MB_ICONERROR, L"Error", FormatBox(hDlg, MB_ICONERROR, L"Error",
L"ActivateKeyboardLayout() failed. %d", GetLastError()); L"ActivateKeyboardLayout() failed. %d", GetLastError());
else UpdateData(hDlg); else UpdateData(hDlg);
//FormatBox(hDlg, 0, L"Activated", L"Prev - %x, err - %d.", hKl, //FormatBox(hDlg, 0, L"Activated", L"Prev - %x, err - %d.", hKl,
// GetLastError()); // GetLastError());
} }
else MessageBox(hDlg, L"No item selected", L"Error", MB_ICONERROR); else MessageBox(hDlg, L"No item selected", L"Error", MB_ICONERROR);
break; break;
} }
case IDC_UNLOAD: case IDC_UNLOAD:
{ {
if((hKl = GetSelectedLayout(hDlg)) != INVALID_HANDLE_VALUE) if((hKl = GetSelectedLayout(hDlg)) != INVALID_HANDLE_VALUE)
{ {
Sleep(GetDelayMilliseconds(hDlg)); Sleep(GetDelayMilliseconds(hDlg));
if(!UnloadKeyboardLayout(hKl)) if(!UnloadKeyboardLayout(hKl))
FormatBox(hDlg, MB_ICONERROR, L"Error", FormatBox(hDlg, MB_ICONERROR, L"Error",
L"UnloadKeyboardLayout() failed. %d", L"UnloadKeyboardLayout() failed. %d",
GetLastError()); GetLastError());
else UpdateData(hDlg); else UpdateData(hDlg);
} }
else MessageBox(hDlg, L"No item selected", L"Error", MB_ICONERROR); else MessageBox(hDlg, L"No item selected", L"Error", MB_ICONERROR);
break; break;
} }
case IDC_LOAD: case IDC_LOAD:
{ {
WCHAR buf[255]; WCHAR buf[255];
GetWindowText(GetDlgItem(hDlg, IDC_KLID), buf, sizeof(buf)); GetWindowText(GetDlgItem(hDlg, IDC_KLID), buf, sizeof(buf));
Sleep(GetDelayMilliseconds(hDlg)); Sleep(GetDelayMilliseconds(hDlg));
if(!LoadKeyboardLayout(buf, GetLoadFlags(hDlg))) if(!LoadKeyboardLayout(buf, GetLoadFlags(hDlg)))
FormatBox(hDlg, MB_ICONERROR, L"Error", FormatBox(hDlg, MB_ICONERROR, L"Error",
L"LoadKeyboardLayout() failed. %d", L"LoadKeyboardLayout() failed. %d",
GetLastError()); GetLastError());
else UpdateData(hDlg); else UpdateData(hDlg);
break; break;
} }
case IDC_REFRESH: case IDC_REFRESH:
{ {
UpdateData(hDlg); UpdateData(hDlg);
break; break;
} }
case IDC_NEWTHREAD: case IDC_NEWTHREAD:
{ {
if(!CreateThread(NULL, 0, ThreadProc, NULL, 0, NULL)) if(!CreateThread(NULL, 0, ThreadProc, NULL, 0, NULL))
{ {
FormatBox(hDlg, MB_ICONERROR, L"Error!", FormatBox(hDlg, MB_ICONERROR, L"Error!",
L"Can not create thread (%d).", GetLastError()); L"Can not create thread (%d).", GetLastError());
} }
} }
case IDC_LIST: case IDC_LIST:
{ {
if(HIWORD(wParam) == LBN_SELCHANGE) if(HIWORD(wParam) == LBN_SELCHANGE)
{ {
WCHAR buf[25]; WCHAR buf[25];
if((hKl = GetSelectedLayout(hDlg)) != NULL) if((hKl = GetSelectedLayout(hDlg)) != NULL)
{ {
swprintf(buf, L"%x", hKl); swprintf(buf, L"%x", hKl);
SetWindowText(GetDlgItem(hDlg, IDC_HANDLE), buf); SetWindowText(GetDlgItem(hDlg, IDC_HANDLE), buf);
} }
} }
break; break;
} }
} }
return TRUE; return TRUE;
} /* WM_COMMAND */ } /* WM_COMMAND */
case WM_INPUTLANGCHANGE: case WM_INPUTLANGCHANGE:
{ {
FormatMsg(L"dlg WM_INPUTLANGCHANGE lParam=%x wParam=%x\n", lParam, wParam); FormatMsg(L"dlg WM_INPUTLANGCHANGE lParam=%x wParam=%x\n", lParam, wParam);
return FALSE; return FALSE;
} }
case WM_INPUTLANGCHANGEREQUEST: case WM_INPUTLANGCHANGEREQUEST:
{ {
FormatMsg(L"dlg WM_INPUTLANGCHANGEREQUEST lParam=%x wParam=%x\n", lParam, wParam); FormatMsg(L"dlg WM_INPUTLANGCHANGEREQUEST lParam=%x wParam=%x\n", lParam, wParam);
UpdateData(hDlg); UpdateData(hDlg);
return FALSE; return FALSE;
} }
case WM_CLOSE: case WM_CLOSE:
{ {
EndDialog(hDlg, ERROR_CANCELLED); EndDialog(hDlg, ERROR_CANCELLED);
return TRUE; return TRUE;
} /* WM_CLOSE */ } /* WM_CLOSE */
default: default:
return FALSE; return FALSE;
} }
} }

View file

@ -1,8 +1,8 @@
<module name="kbdlayout" type="win32gui" installbase="system32" installname="kbdlayout.exe"> <module name="kbdlayout" type="win32gui" installbase="system32" installname="kbdlayout.exe">
<include base="kbdlayout">.</include> <include base="kbdlayout">.</include>
<library>kernel32</library> <library>kernel32</library>
<library>user32</library> <library>user32</library>
<library>gdi32</library> <library>gdi32</library>
<file>kbdlayout.c</file> <file>kbdlayout.c</file>
<file>kbdlayout.rc</file> <file>kbdlayout.rc</file>
</module> </module>

View file

@ -1,46 +1,46 @@
//{{NO_DEPENDENCIES}} //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file. // Microsoft Developer Studio generated include file.
// Used by kbdlayout.rc // Used by kbdlayout.rc
// //
#define IDD_MAINDIALOG 101 #define IDD_MAINDIALOG 101
#define ID_CANCEL 1000 #define ID_CANCEL 1000
#define IDC_EDIT1 1021 #define IDC_EDIT1 1021
#define IDC_LIST 1022 #define IDC_LIST 1022
#define IDC_ACTIVE 1023 #define IDC_ACTIVE 1023
#define IDC_EDIT2 1024 #define IDC_EDIT2 1024
#define IDC_DELAY 1024 #define IDC_DELAY 1024
#define IDC_UNLOAD 1025 #define IDC_UNLOAD 1025
#define IDC_ACTIVATE 1026 #define IDC_ACTIVATE 1026
#define IDC_KLF_REORDER 1027 #define IDC_KLF_REORDER 1027
#define IDC_KLF_RESET 1028 #define IDC_KLF_RESET 1028
#define IDC_KLF_SETFORPROCESS 1029 #define IDC_KLF_SETFORPROCESS 1029
#define IDC_KLF_SHIFTLOCK 1030 #define IDC_KLF_SHIFTLOCK 1030
#define IDC_FROMLIST 1032 #define IDC_FROMLIST 1032
#define IDC_HKL_NEXT 1033 #define IDC_HKL_NEXT 1033
#define IDC_HKL_PREV 1034 #define IDC_HKL_PREV 1034
#define IDL_KLF_ACTIVATE 1035 #define IDL_KLF_ACTIVATE 1035
#define IDL_KLF_NOTELLSHELL 1036 #define IDL_KLF_NOTELLSHELL 1036
#define IDC_KLID 1037 #define IDC_KLID 1037
#define IDL_KLF_REORDER 1038 #define IDL_KLF_REORDER 1038
#define IDL_KLF_REPLACELANG 1039 #define IDL_KLF_REPLACELANG 1039
#define IDL_KLF_SUBSTITUTE_OK 1040 #define IDL_KLF_SUBSTITUTE_OK 1040
#define IDL_KLF_SETFORPROCESS 1041 #define IDL_KLF_SETFORPROCESS 1041
#define IDC_HKL_PREV2 1042 #define IDC_HKL_PREV2 1042
#define IDC_FROMEDIT 1042 #define IDC_FROMEDIT 1042
#define IDC_LOAD 1043 #define IDC_LOAD 1043
#define IDC_REFRESH 1044 #define IDC_REFRESH 1044
#define IDC_HANDLE 1046 #define IDC_HANDLE 1046
#define IDC_CURTHREAD 1049 #define IDC_CURTHREAD 1049
#define IDC_NEWTHREAD 1050 #define IDC_NEWTHREAD 1050
// Next default values for new objects // Next default values for new objects
// //
#ifdef APSTUDIO_INVOKED #ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1 #define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 105 #define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1051 #define _APS_NEXT_CONTROL_VALUE 1051
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif #endif
#endif #endif

View file

@ -1,8 +1,8 @@
Index: server.c Index: server.c
=================================================================== ===================================================================
--- server.c (revision 38883) --- server.c (revision 38883)
+++ server.c (working copy) +++ server.c (working copy)
@@ -352,12 +352,6 @@ @@ -352,12 +352,6 @@
} }
int int
@ -15,7 +15,7 @@ Index: server.c
s_sum_pcarr(int *a[], int n) s_sum_pcarr(int *a[], int n)
{ {
int i, s = 0; int i, s = 0;
@@ -367,6 +361,12 @@ @@ -367,6 +361,12 @@
} }
int int