Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

250 lines
7.4 KiB

  1. /*
  2. File: cpanel.h
  3. Project: Universal Joystick Control Panel OLE Client
  4. Author: Brycej
  5. Date: 02/08/95
  6. Comments:
  7. general header file
  8. Copyright (c) 1995, Microsoft Corporation
  9. */
  10. #define DIRECTINPUT_VERSION 0x05B2
  11. #ifndef _CPANEL_H_
  12. #define _CPANEL_H_
  13. #include <commctrl.h>
  14. #define _INC_MMSYSTEM
  15. #define WINMMAPI DECLSPEC_IMPORT
  16. typedef UINT MMRESULT; /* error return code, 0 means no error */
  17. /* call as if(err=xxxx(...)) Error(err); else */
  18. // end of hack to avoid including mmsystem.h!!!
  19. #ifndef _UNICODE
  20. #include <malloc.h> // for alloca
  21. #include <afxconv.h> // for AfxW2AHelper
  22. //USES_CONVERSION;
  23. #endif
  24. // DI includes
  25. #include "dinput.h"
  26. #include "dinputd.h"
  27. #include "resource.h"
  28. #include "sstructs.h"
  29. #include "ifacesvr.h" // also has HSrvGuid.h!!!
  30. #ifndef PPVOID
  31. typedef LPVOID* PPVOID;
  32. #endif
  33. typedef HRESULT (STDAPICALLTYPE * LPFNDIRECTINPUTCREATE)(HINSTANCE hinst, DWORD dwVersion, LPDIRECTINPUT *ppDI, LPUNKNOWN punkOuter);
  34. #ifndef USES_CONVERSION
  35. #ifndef _DEBUG
  36. #define USES_CONVERSION int _convert; _convert
  37. #else
  38. #define USES_CONVERSION int _convert = 0;
  39. #endif
  40. #endif // USES_CONVERSION
  41. #ifndef A2W
  42. #define A2W(lpa) (((LPCSTR)lpa == NULL) ? NULL : (_convert = (lstrlenA(lpa)+1), AfxA2WHelper((LPWSTR) alloca(_convert*2), lpa, _convert)))
  43. #endif // A2W
  44. #ifndef W2A
  45. #define W2A(lpw) (((LPCWSTR)lpw == NULL) ? NULL : (_convert = (wcslen(lpw)+1)*2, AfxW2AHelper((LPTSTR) alloca(_convert), lpw, _convert)))
  46. #endif // W2A
  47. //#define IMAGE_NOTCONNECTED 0
  48. const int IMAGE_DEFAULTJOY = 0;
  49. const BYTE NUMJOYDEVS = 16;
  50. #define ID_NONE 0x10000 // This gets ID_NONE out of the low word of the extended info!
  51. //#define SUPPORT_TWO_2A2B 1
  52. #define MUTEX_NAME TEXT("$$$MS_GameControllers_Cpl$$$")
  53. // max string length for language strings
  54. #define MAX_STR_LEN 255
  55. #define STR_LEN_128 128
  56. #define STR_LEN_64 64
  57. #define STR_LEN_32 32
  58. #define MAX_DEVICES 75
  59. #define MAX_BUSSES 10
  60. #define MAX_GLOBAL_PORT_DRIVERS 10
  61. #define MAX_ASSIGNED 32
  62. // flags for bNeedUpdate!
  63. #define UPDATE_FOR_ADV 0x01
  64. #define UPDATE_FOR_GEN 0x02
  65. #define UPDATE_ALL UPDATE_FOR_ADV | UPDATE_FOR_GEN
  66. #define UPDATE_INPROCESS 0x04
  67. #define ON_PAGE 0x08
  68. #define USER_MODE 0x10
  69. #define BLOCK_UPDATE 0x20 // This Blocks WM_DEVICECHANGE messages from doing anything!!!
  70. // If you use this, remove it when you are done!
  71. #define ON_NT 0x40
  72. // DI define for Get and Set Config to support all currently support bit flags
  73. #define DIJC_ALL DIJC_REGHWCONFIGTYPE | DIJC_CALLOUT | DIJC_WDMGAMEPORT | DIJC_GAIN | DIJC_GUIDINSTANCE
  74. #define DITC_ALL DITC_CLSIDCONFIG | DITC_REGHWSETTINGS | DITC_DISPLAYNAME | DITC_CALLOUT | DITC_HARDWAREID
  75. // General Column IDs
  76. #define DEVICE_COLUMN 0
  77. #define STATUS_COLUMN 1
  78. class CDIGameCntrlPropSheet : public IDIGameCntrlPropSheet
  79. {
  80. private:
  81. DWORD m_cProperty_refcount;
  82. public:
  83. CDIGameCntrlPropSheet(void);
  84. ~CDIGameCntrlPropSheet(void);
  85. // IUnknown methods
  86. STDMETHODIMP QueryInterface(REFIID, PPVOID);
  87. STDMETHODIMP_(ULONG) AddRef(void);
  88. STDMETHODIMP_(ULONG) Release(void);
  89. // CImpIServerProperty methods
  90. STDMETHODIMP GetSheetInfo(LPDIGCSHEETINFO *lpSheetInfo);
  91. STDMETHODIMP GetPageInfo (LPDIGCPAGEINFO *lpPageInfo );
  92. STDMETHODIMP SetID(USHORT nID);
  93. STDMETHODIMP_(USHORT) GetID(void);
  94. };
  95. typedef CDIGameCntrlPropSheet *LPCDIGAMECNTRLPROPSHEET;
  96. struct JOY
  97. {
  98. char ID;
  99. BYTE nStatus;
  100. BYTE nButtons;
  101. CLSID clsidPropSheet;
  102. BOOL fHasOemSheet;
  103. LPDIRECTINPUTDEVICE2 fnDeviceInterface;
  104. JOY();
  105. virtual ~JOY();
  106. };
  107. typedef JOY *PJOY;
  108. int CALLBACK CompareListItems(LPARAM, LPARAM, LPARAM);
  109. int CALLBACK CompareStatusItems(LPARAM, LPARAM, LPARAM);
  110. LRESULT GetHelpFileName(LPTSTR lpszHelpFileName, short* nSize);
  111. BOOL CreateJoyConfigInterface( void );
  112. BOOL DeleteAssignedType( LPWSTR lpwszType );
  113. void OnHelp(LPARAM); // for ? help - lives in Add.cpp!
  114. BOOL PopulatePortList( HWND hCtrl ); // Lives in Add.cpp!
  115. void Error (short nTitleID, short nMsgID); // Lives in Cpanel.cpp
  116. void itoa(BYTE n, LPTSTR lpStr);
  117. BOOL SortTextItems( CListCtrl *pCtrl, short nCol, BOOL bAscending, short low, short high );
  118. BOOL DeleteSelectedItem( PBYTE nItem );
  119. // DI Callback proc for enumerating the DI devices
  120. BOOL CALLBACK DIEnumJoyTypeProc(LPCWSTR pwszTypeName, LPVOID pvRef );
  121. BOOL CALLBACK DIEnumDevicesProc(LPDIDEVICEINSTANCE lpDeviceInst, LPVOID lpVoid);
  122. HRESULT Enumerate( HWND hDlg );
  123. #ifdef DX7
  124. BOOL CALLBACK DIEnumMiceProc(LPDIDEVICEINSTANCE lpDeviceInst, LPVOID lpVoid);
  125. BOOL CALLBACK DIEnumKeyboardsProc(LPDIDEVICEINSTANCE lpDeviceInst, LPVOID lpVoid);
  126. #endif // DX7
  127. //LPCDIGAMECNTRLPROPSHEET HasInterface( REFCLSID refCLSID, HINSTANCE hOleInst );
  128. void ClearArrays ( void );
  129. void PostDlgItemEnableWindow( HWND hDlg, USHORT nItem, BOOL bEnabled);
  130. void PostEnableWindow ( HWND hCtrl, BOOL bEnabled );
  131. void MoveOK ( HWND hParentWnd );
  132. void LaunchExtention ( HWND hWnd );
  133. // ListControl helper functions!!!
  134. DWORD GetItemData ( HWND hCtrl, BYTE nItem );
  135. BOOL SetItemData ( HWND hCtrl, BYTE nItem, DWORD dwFlag );
  136. void InsertColumn ( HWND hCtrl, BYTE nColumn, USHORT nStrID, USHORT nWidth );
  137. void SetListCtrlItemFocus ( HWND hCtrl, BYTE nItem );
  138. void SetItemText ( HWND hCtrl, BYTE nItem, BYTE nSubItem, LPTSTR lpStr);
  139. BYTE GetItemText ( HWND hCtrl, BYTE nItem, BYTE nSubItem, LPTSTR lpszBuff, BYTE nLen );
  140. BYTE InsertItem ( HWND hCtrl, LPTSTR lpszBuff, BYTE nItem);
  141. void SwapIDs ( BYTE nSource, BYTE nTarget);
  142. #ifdef _UNICODE
  143. void RegisterForDevChange(HWND hDlg, PVOID *hNodifyDevNode);
  144. #endif
  145. #define SETTINGS_PAGE 0
  146. #define TEST_PAGE 1
  147. #define DIAGNOSTICS_PAGE 2
  148. #define MENU_OFFSET 2800
  149. // Dialog proc definitions
  150. INT_PTR CALLBACK CPanelProc (HWND, UINT, WPARAM, LPARAM);
  151. INT_PTR CALLBACK AdvancedProc (HWND, UINT, WPARAM, LPARAM);
  152. INT_PTR CALLBACK AppManProc (HWND, UINT, WPARAM, LPARAM);
  153. INT_PTR CALLBACK AppManLockProc (HWND, UINT, WPARAM, LPARAM);
  154. INT_PTR CALLBACK AddDialogProc (HWND, UINT, WPARAM, LPARAM);
  155. INT_PTR CALLBACK CustomDialogProc (HWND, UINT, WPARAM, LPARAM);
  156. INT_PTR CALLBACK ChangeDialogProc (HWND, UINT, WPARAM, LPARAM);
  157. HRESULT Launch(HWND hWnd, PJOY pJoy, BYTE nStartPage);
  158. // Local String function prototypes
  159. #ifdef STRINGS_IN_LOCAL_RESOURCE
  160. BOOL RCSetDlgItemText( HWND hDlg, USHORT nCtrlID, USHORT nStringID);
  161. #endif // STRINGS_IN_LOCAL_RESOURCE
  162. #ifndef LVM_SETEXTENDEDLISTVIEWSTYLE
  163. #define LVM_SETEXTENDEDLISTVIEWSTYLE (LVM_FIRST+54)
  164. #endif
  165. #ifndef LVS_EX_FULLROWSELECT
  166. #define LVS_EX_FULLROWSELECT 0x00000020
  167. #endif
  168. #ifndef LVS_EX_TRACKSELECT
  169. #define LVS_EX_TRACKSELECT 0x00000008
  170. #endif
  171. DEFINE_GUID(CLSID_NULL, 0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
  172. inline int atoiW(const WCHAR *sz)
  173. {
  174. BYTE i = 0;
  175. while (*sz && *sz >= L'0' && *sz <= L'9')
  176. i = i*10 + *sz++ - L'0';
  177. return i;
  178. }
  179. inline int WINAPI atoiA(const CHAR *sz)
  180. {
  181. BYTE i = 0;
  182. while (*sz && *sz >= '0' && *sz <= '9')
  183. i = i*10 + *sz++ - '0';
  184. return i;
  185. }
  186. #ifdef UNICODE
  187. #define atoi atoiW
  188. #else
  189. #define atoi atoiA
  190. #endif
  191. // update.cpp
  192. // void Update(HWND hDlg, int nAccess, TCHAR *tszProxy);
  193. // INT_PTR CALLBACK CplUpdateProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
  194. #endif //_CPANEL_H_