- 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
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
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
Foundation's software and to any other program whose authors commit to
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.
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
modification follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
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
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
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
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
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
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
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 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
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
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
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
@ -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.
<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
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
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
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
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'.
This is free software, and you are welcome to redistribute it
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
proprietary programs. If your program is a subroutine library, you may
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.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,33 +1,33 @@
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
int main()
{
TCHAR Buffer = 0;
DWORD Count = 0;
//
// 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
//
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),0);
//
// We read one char from the input and then return
//
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
//
_tprintf(TEXT("You printed %c :: "), Buffer);
_tprintf(TEXT("With a value %d :: "), Buffer);
_tprintf(TEXT("Number of chars recieved %lu :: "), Count);
_tprintf(TEXT("Char equal to backspace %d \n"), (Buffer == TEXT('\b')));
//
// :)
//
return 0;
}
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
int main()
{
TCHAR Buffer = 0;
DWORD Count = 0;
//
// 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
//
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),0);
//
// We read one char from the input and then return
//
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
//
_tprintf(TEXT("You printed %c :: "), Buffer);
_tprintf(TEXT("With a value %d :: "), Buffer);
_tprintf(TEXT("Number of chars recieved %lu :: "), Count);
_tprintf(TEXT("Char equal to backspace %d \n"), (Buffer == TEXT('\b')));
//
// :)
//
return 0;
}

View file

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

View file

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

View file

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

View file

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