From: Piotr Caban piotr@codeweavers.com
--- include/ddk/compstui.h | 408 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 403 insertions(+), 5 deletions(-)
diff --git a/include/ddk/compstui.h b/include/ddk/compstui.h index 63612f43b35..aa167830207 100644 --- a/include/ddk/compstui.h +++ b/include/ddk/compstui.h @@ -27,20 +27,418 @@ extern "C" { #endif
/* DEFINES */ +#define PROPSHEETUI_REASON_INIT 0 +#define PROPSHEETUI_REASON_GET_INFO_HEADER 1 +#define PROPSHEETUI_REASON_DESTROY 2 +#define PROPSHEETUI_REASON_SET_RESULT 3 +#define PROPSHEETUI_REASON_GET_ICON 4 +#define PROPSHEETUI_REASON_BEFORE_INIT 5 +#define MAX_PROPSHEETUI_REASON_INDEX 5
#define PROPSHEETUI_INFO_VERSION 0x0100
#define PSUIINFO_UNICODE 1
+#define CPSFUNC_ADD_HPROPSHEETPAGE 0 +#define CPSFUNC_ADD_PROPSHEETPAGEW 1 +#define CPSFUNC_ADD_PCOMPROPSHEETUIA 2 +#define CPSFUNC_ADD_PCOMPROPSHEETUIW 3 +#define CPSFUNC_ADD_PFNPROPSHEETUIA 4 +#define CPSFUNC_ADD_PFNPROPSHEETUIW 5 +#define CPSFUNC_DELETE_HCOMPROPSHEET 6 +#define CPSFUNC_SET_HSTARTPAGE 7 +#define CPSFUNC_GET_PAGECOUNT 8 +#define CPSFUNC_SET_RESULT 9 +#define CPSFUNC_GET_HPSUIPAGES 10 +#define CPSFUNC_LOAD_CPSUI_STRINGA 11 +#define CPSFUNC_LOAD_CPSUI_STRINGW 12 +#define CPSFUNC_LOAD_CPSUI_ICON 13 +#define CPSFUNC_GET_PFNPROPSHEETUI_ICON 14 +#define CPSFUNC_ADD_PROPSHEETPAGEA 15 +#define CPSFUNC_INSERT_PSUIPAGEA 16 +#define CPSFUNC_INSERT_PSUIPAGEW 17 +#define CPSFUNC_SET_PSUIPAGE_TITLEA 18 +#define CPSFUNC_SET_PSUIPAGE_TITLEW 19 +#define CPSFUNC_SET_PSUIPAGE_ICON 20 +#define CPSFUNC_SET_DATABLOCK 21 +#define CPSFUNC_QUERY_DATABLOCK 22 +#define CPSFUNC_SET_DMPUB_HIDEBITS 23 +#define CPSFUNC_IGNORE_CPSUI_PSN_APPLY 24 +#define CPSFUNC_DO_APPLY_CPSUI 25 +#define CPSFUNC_SET_FUSION_CONTEXT 26 +#define MAX_CPSFUNC_INDEX 26 + +#define PSUIHDRF_OBSOLETE 0x01 +#define PSUIHDRF_NOAPPLYNOW 0x02 +#define PSUIHDRF_PROPTITLE 0x04 +#define PSUIHDRF_USEHICON 0x08 +#define PSUIHDRF_DEFTITLE 0x10 +#define PSUIHDRF_EXACT_PTITLE 0x20 + /* return-values for CommonPropertySheetUI on success */ #define CPSUI_CANCEL 0 #define CPSUI_OK 1 #define CPSUI_RESTARTWINDOWS 2 #define CPSUI_REBOOTSYSTEM 3
+#define ERR_CPSUI_GETLASTERROR -1 +#define ERR_CPSUI_ALLOCMEM_FAILED -2 +#define ERR_CPSUI_INVALID_PDATA -3 +#define ERR_CPSUI_INVALID_LPARAM -4 +#define ERR_CPSUI_NULL_HINST -5 +#define ERR_CPSUI_NULL_CALLERNAME -6 +#define ERR_CPSUI_NULL_OPTITEMNAME -7 +#define ERR_CPSUI_NO_PROPSHEETPAGE -8 +#define ERR_CPSUI_TOO_MANY_PROPSHEETPAGES -9 +#define ERR_CPSUI_CREATEPROPPAGE_FAILED -10 +#define ERR_CPSUI_MORE_THAN_ONE_TVPAGE -11 +#define ERR_CPSUI_MORE_THAN_ONE_STDPAGE -12 +#define ERR_CPSUI_INVALID_PDLGPAGE -13 +#define ERR_CPSUI_INVALID_DLGPAGE_CBSIZE -14 +#define ERR_CPSUI_TOO_MANY_DLGPAGES -15 +#define ERR_CPSUI_INVALID_DLGPAGEIDX -16 +#define ERR_CPSUI_SUBITEM_DIFF_DLGPAGEIDX -17 +#define ERR_CPSUI_NULL_POPTITEM -18 +#define ERR_CPSUI_INVALID_OPTITEM_CBSIZE -19 +#define ERR_CPSUI_INVALID_OPTTYPE_CBSIZE -20 +#define ERR_CPSUI_INVALID_OPTTYPE_COUNT -21 +#define ERR_CPSUI_NULL_POPTPARAM -22 +#define ERR_CPSUI_INVALID_OPTPARAM_CBSIZE -23 +#define ERR_CPSUI_INVALID_EDITBOX_PSEL -24 +#define ERR_CPSUI_INVALID_EDITBOX_BUF_SIZE -25 +#define ERR_CPSUI_INVALID_ECB_CBSIZE -26 +#define ERR_CPSUI_NULL_ECB_PTITLE -27 +#define ERR_CPSUI_NULL_ECB_PCHECKEDNAME -28 +#define ERR_CPSUI_INVALID_DMPUBID -29 +#define ERR_CPSUI_INVALID_DMPUB_TVOT -30 +#define ERR_CPSUI_CREATE_TRACKBAR_FAILED -31 +#define ERR_CPSUI_CREATE_UDARROW_FAILED -32 +#define ERR_CPSUI_CREATE_IMAGELIST_FAILED -33 +#define ERR_CPSUI_INVALID_TVOT_TYPE -34 +#define ERR_CPSUI_INVALID_LBCB_TYPE -35 +#define ERR_CPSUI_SUBITEM_DIFF_OPTIF_HIDE -36 +#define ERR_CPSUI_INVALID_PUSHBUTTON_TYPE -38 +#define ERR_CPSUI_INVALID_EXTPUSH_CBSIZE -39 +#define ERR_CPSUI_NULL_EXTPUSH_DLGPROC -40 +#define ERR_CPSUI_NO_EXTPUSH_DLGTEMPLATEID -41 +#define ERR_CPSUI_NULL_EXTPUSH_CALLBACK -42 +#define ERR_CPSUI_DMCOPIES_USE_EXTPUSH -43 +#define ERR_CPSUI_ZERO_OPTITEM -44 + +#define ERR_CPSUI_FUNCTION_NOT_IMPLEMENTED -9999 +#define ERR_CPSUI_INTERNAL_ERROR -10000 + +#define IDI_CPSUI_ICONID_FIRST 64000 +#define IDI_CPSUI_EMPTY 64000 +#define IDI_CPSUI_SEL_NONE 64001 +#define IDI_CPSUI_WARNING 64002 +#define IDI_CPSUI_NO 64003 +#define IDI_CPSUI_YES 64004 +#define IDI_CPSUI_FALSE 64005 +#define IDI_CPSUI_TRUE 64006 +#define IDI_CPSUI_OFF 64007 +#define IDI_CPSUI_ON 64008 +#define IDI_CPSUI_PAPER_OUTPUT 64009 +#define IDI_CPSUI_ENVELOPE 64010 +#define IDI_CPSUI_MEM 64011 +#define IDI_CPSUI_FONTCARTHDR 64012 +#define IDI_CPSUI_FONTCART 64013 +#define IDI_CPSUI_STAPLER_ON 64014 +#define IDI_CPSUI_STAPLER_OFF 64015 +#define IDI_CPSUI_HT_HOST 64016 +#define IDI_CPSUI_HT_DEVICE 64017 +#define IDI_CPSUI_TT_PRINTASGRAPHIC 64018 +#define IDI_CPSUI_TT_DOWNLOADSOFT 64019 +#define IDI_CPSUI_TT_DOWNLOADVECT 64020 +#define IDI_CPSUI_TT_SUBDEV 64021 +#define IDI_CPSUI_PORTRAIT 64022 +#define IDI_CPSUI_LANDSCAPE 64023 +#define IDI_CPSUI_ROT_LAND 64024 +#define IDI_CPSUI_AUTOSEL 64025 +#define IDI_CPSUI_PAPER_TRAY 64026 +#define IDI_CPSUI_PAPER_TRAY2 64027 +#define IDI_CPSUI_PAPER_TRAY3 64028 +#define IDI_CPSUI_TRANSPARENT 64029 +#define IDI_CPSUI_COLLATE 64030 +#define IDI_CPSUI_DUPLEX_NONE 64031 +#define IDI_CPSUI_DUPLEX_HORZ 64032 +#define IDI_CPSUI_DUPLEX_VERT 64033 +#define IDI_CPSUI_RES_DRAFT 64034 +#define IDI_CPSUI_RES_LOW 64035 +#define IDI_CPSUI_RES_MEDIUM 64036 +#define IDI_CPSUI_RES_HIGH 64037 +#define IDI_CPSUI_RES_PRESENTATION 64038 +#define IDI_CPSUI_MONO 64039 +#define IDI_CPSUI_COLOR 64040 +#define IDI_CPSUI_DITHER_NONE 64041 +#define IDI_CPSUI_DITHER_COARSE 64042 +#define IDI_CPSUI_DITHER_FINE 64043 +#define IDI_CPSUI_DITHER_LINEART 64044 +#define IDI_CPSUI_SCALING 64045 +#define IDI_CPSUI_COPY 64046 +#define IDI_CPSUI_HTCLRADJ 64047 +#define IDI_CPSUI_HALFTONE_SETUP 64048 +#define IDI_CPSUI_WATERMARK 64049 +#define IDI_CPSUI_ERROR 64050 +#define IDI_CPSUI_ICM_OPTION 64051 +#define IDI_CPSUI_ICM_METHOD 64052 +#define IDI_CPSUI_ICM_INTENT 64053 +#define IDI_CPSUI_STD_FORM 64054 +#define IDI_CPSUI_OUTBIN 64055 +#define IDI_CPSUI_OUTPUT 64056 +#define IDI_CPSUI_GRAPHIC 64057 +#define IDI_CPSUI_ADVANCE 64058 +#define IDI_CPSUI_DOCUMENT 64059 +#define IDI_CPSUI_DEVICE 64060 +#define IDI_CPSUI_DEVICE2 64061 +#define IDI_CPSUI_PRINTER 64062 +#define IDI_CPSUI_PRINTER2 64063 +#define IDI_CPSUI_PRINTER3 64064 +#define IDI_CPSUI_PRINTER4 64065 +#define IDI_CPSUI_OPTION 64066 +#define IDI_CPSUI_OPTION2 64067 +#define IDI_CPSUI_STOP 64068 +#define IDI_CPSUI_NOTINSTALLED 64069 +#define IDI_CPSUI_WARNING_OVERLAY 64070 +#define IDI_CPSUI_STOP_WARNING_OVERLAY 64071 +#define IDI_CPSUI_GENERIC_OPTION 64072 +#define IDI_CPSUI_GENERIC_ITEM 64073 +#define IDI_CPSUI_RUN_DIALOG 64074 +#define IDI_CPSUI_QUESTION 64075 +#define IDI_CPSUI_FORMTRAYASSIGN 64076 +#define IDI_CPSUI_PRINTER_FOLDER 64077 +#define IDI_CPSUI_INSTALLABLE_OPTION 64078 +#define IDI_CPSUI_PRINTER_FEATURE 64079 +#define IDI_CPSUI_DEVICE_FEATURE 64080 +#define IDI_CPSUI_FONTSUB 64081 +#define IDI_CPSUI_POSTSCRIPT 64082 +#define IDI_CPSUI_TELEPHONE 64083 +#define IDI_CPSUI_DUPLEX_NONE_L 64084 +#define IDI_CPSUI_DUPLEX_HORZ_L 64085 +#define IDI_CPSUI_DUPLEX_VERT_L 64086 +#define IDI_CPSUI_LF_PEN_PLOTTER 64087 +#define IDI_CPSUI_SF_PEN_PLOTTER 64088 +#define IDI_CPSUI_LF_RASTER_PLOTTER 64089 +#define IDI_CPSUI_SF_RASTER_PLOTTER 64090 +#define IDI_CPSUI_ROLL_PAPER 64091 +#define IDI_CPSUI_PEN_CARROUSEL 64092 +#define IDI_CPSUI_PLOTTER_PEN 64093 +#define IDI_CPSUI_MANUAL_FEED 64094 +#define IDI_CPSUI_FAX 64095 +#define IDI_CPSUI_PAGE_PROTECT 64096 +#define IDI_CPSUI_ENVELOPE_FEED 64097 +#define IDI_CPSUI_FONTCART_SLOT 64098 +#define IDI_CPSUI_LAYOUT_BMP_PORTRAIT 64099 +#define IDI_CPSUI_LAYOUT_BMP_ARROWL 64100 +#define IDI_CPSUI_LAYOUT_BMP_ARROWS 64101 +#define IDI_CPSUI_LAYOUT_BMP_BOOKLETL 64102 +#define IDI_CPSUI_LAYOUT_BMP_BOOKLETP 64103 +#define IDI_CPSUI_LAYOUT_BMP_ARROWLR 64104 +#define IDI_CPSUI_LAYOUT_BMP_ROT_PORT 64105 +#define IDI_CPSUI_LAYOUT_BMP_BOOKLETL_NB 64106 +#define IDI_CPSUI_LAYOUT_BMP_BOOKLETP_NB 64107 +#define IDI_CPSUI_ROT_PORT 64110 +#define IDI_CPSUI_NUP_BORDER 64111 +#define IDI_CPSUI_ICONID_LAST 64111 + +#define IDS_CPSUI_STRID_FIRST 64700 +#define IDS_CPSUI_SETUP 64700 +#define IDS_CPSUI_MORE 64701 +#define IDS_CPSUI_CHANGE 64702 +#define IDS_CPSUI_OPTION 64703 +#define IDS_CPSUI_OF 64704 +#define IDS_CPSUI_RANGE_FROM 64705 +#define IDS_CPSUI_TO 64706 +#define IDS_CPSUI_COLON_SEP 64707 +#define IDS_CPSUI_LEFT_ANGLE 64708 +#define IDS_CPSUI_RIGHT_ANGLE 64709 +#define IDS_CPSUI_SLASH_SEP 64710 +#define IDS_CPSUI_PERCENT 64711 +#define IDS_CPSUI_LBCB_NOSEL 64712 +#define IDS_CPSUI_PROPERTIES 64713 +#define IDS_CPSUI_DEFAULTDOCUMENT 64714 +#define IDS_CPSUI_DOCUMENT 64715 +#define IDS_CPSUI_ADVANCEDOCUMENT 64716 +#define IDS_CPSUI_PRINTER 64717 +#define IDS_CPSUI_AUTOSELECT 64718 +#define IDS_CPSUI_PAPER_OUTPUT 64719 +#define IDS_CPSUI_GRAPHIC 64720 +#define IDS_CPSUI_OPTIONS 64721 +#define IDS_CPSUI_ADVANCED 64722 +#define IDS_CPSUI_STDDOCPROPTAB 64723 +#define IDS_CPSUI_STDDOCPROPTVTAB 64724 +#define IDS_CPSUI_DEVICEOPTIONS 64725 +#define IDS_CPSUI_FALSE 64726 +#define IDS_CPSUI_TRUE 64727 +#define IDS_CPSUI_NO 64728 +#define IDS_CPSUI_YES 64729 +#define IDS_CPSUI_OFF 64730 +#define IDS_CPSUI_ON 64731 +#define IDS_CPSUI_DEFAULT 64732 +#define IDS_CPSUI_ERROR 64733 +#define IDS_CPSUI_NONE 64734 +#define IDS_CPSUI_NOT 64735 +#define IDS_CPSUI_EXIST 64736 +#define IDS_CPSUI_NOTINSTALLED 64737 +#define IDS_CPSUI_ORIENTATION 64738 +#define IDS_CPSUI_SCALING 64739 +#define IDS_CPSUI_NUM_OF_COPIES 64740 +#define IDS_CPSUI_SOURCE 64741 +#define IDS_CPSUI_PRINTQUALITY 64742 +#define IDS_CPSUI_RESOLUTION 64743 +#define IDS_CPSUI_COLOR_APPERANCE 64744 +#define IDS_CPSUI_DUPLEX 64745 +#define IDS_CPSUI_TTOPTION 64746 +#define IDS_CPSUI_FORMNAME 64747 +#define IDS_CPSUI_ICM 64748 +#define IDS_CPSUI_ICMMETHOD 64749 +#define IDS_CPSUI_ICMINTENT 64750 +#define IDS_CPSUI_MEDIA 64751 +#define IDS_CPSUI_DITHERING 64752 +#define IDS_CPSUI_PORTRAIT 64753 +#define IDS_CPSUI_LANDSCAPE 64754 +#define IDS_CPSUI_ROT_LAND 64755 +#define IDS_CPSUI_COLLATE 64756 +#define IDS_CPSUI_COLLATED 64757 +#define IDS_CPSUI_PRINTFLDSETTING 64758 +#define IDS_CPSUI_DRAFT 64759 +#define IDS_CPSUI_LOW 64760 +#define IDS_CPSUI_MEDIUM 64761 +#define IDS_CPSUI_HIGH 64762 +#define IDS_CPSUI_PRESENTATION 64763 +#define IDS_CPSUI_COLOR 64764 +#define IDS_CPSUI_GRAYSCALE 64765 +#define IDS_CPSUI_MONOCHROME 64766 +#define IDS_CPSUI_SIMPLEX 64767 +#define IDS_CPSUI_HORIZONTAL 64768 +#define IDS_CPSUI_VERTICAL 64769 +#define IDS_CPSUI_LONG_SIDE 64770 +#define IDS_CPSUI_SHORT_SIDE 64771 +#define IDS_CPSUI_TT_PRINTASGRAPHIC 64772 +#define IDS_CPSUI_TT_DOWNLOADSOFT 64773 +#define IDS_CPSUI_TT_DOWNLOADVECT 64774 +#define IDS_CPSUI_TT_SUBDEV 64775 +#define IDS_CPSUI_ICM_BLACKWHITE 64776 +#define IDS_CPSUI_ICM_NO 64777 +#define IDS_CPSUI_ICM_YES 64778 +#define IDS_CPSUI_ICM_SATURATION 64779 +#define IDS_CPSUI_ICM_CONTRAST 64780 +#define IDS_CPSUI_ICM_COLORMETRIC 64781 +#define IDS_CPSUI_STANDARD 64782 +#define IDS_CPSUI_GLOSSY 64783 +#define IDS_CPSUI_TRANSPARENCY 64784 +#define IDS_CPSUI_REGULAR 64785 +#define IDS_CPSUI_BOND 64786 +#define IDS_CPSUI_COARSE 64787 +#define IDS_CPSUI_FINE 64788 +#define IDS_CPSUI_LINEART 64789 +#define IDS_CPSUI_ERRDIFFUSE 64790 +#define IDS_CPSUI_HALFTONE 64791 +#define IDS_CPSUI_HTCLRADJ 64792 +#define IDS_CPSUI_USE_HOST_HT 64793 +#define IDS_CPSUI_USE_DEVICE_HT 64794 +#define IDS_CPSUI_USE_PRINTER_HT 64795 +#define IDS_CPSUI_OUTBINASSIGN 64796 +#define IDS_CPSUI_WATERMARK 64797 +#define IDS_CPSUI_FORMTRAYASSIGN 64798 +#define IDS_CPSUI_UPPER_TRAY 64799 +#define IDS_CPSUI_ONLYONE 64800 +#define IDS_CPSUI_LOWER_TRAY 64801 +#define IDS_CPSUI_MIDDLE_TRAY 64802 +#define IDS_CPSUI_MANUAL_TRAY 64803 +#define IDS_CPSUI_ENVELOPE_TRAY 64804 +#define IDS_CPSUI_ENVMANUAL_TRAY 64805 +#define IDS_CPSUI_TRACTOR_TRAY 64806 +#define IDS_CPSUI_SMALLFMT_TRAY 64807 +#define IDS_CPSUI_LARGEFMT_TRAY 64808 +#define IDS_CPSUI_LARGECAP_TRAY 64809 +#define IDS_CPSUI_CASSETTE_TRAY 64810 +#define IDS_CPSUI_DEFAULT_TRAY 64811 +#define IDS_CPSUI_FORMSOURCE 64812 +#define IDS_CPSUI_MANUALFEED 64813 +#define IDS_CPSUI_PRINTERMEM_KB 64814 +#define IDS_CPSUI_PRINTERMEM_MB 64815 +#define IDS_CPSUI_PAGEPROTECT 64816 +#define IDS_CPSUI_HALFTONE_SETUP 64817 +#define IDS_CPSUI_INSTFONTCART 64818 +#define IDS_CPSUI_SLOT1 64819 +#define IDS_CPSUI_SLOT2 64820 +#define IDS_CPSUI_SLOT3 64821 +#define IDS_CPSUI_SLOT4 64822 +#define IDS_CPSUI_LEFT_SLOT 64823 +#define IDS_CPSUI_RIGHT_SLOT 64824 +#define IDS_CPSUI_STAPLER 64825 +#define IDS_CPSUI_STAPLER_ON 64826 +#define IDS_CPSUI_STAPLER_OFF 64827 +#define IDS_CPSUI_STACKER 64828 +#define IDS_CPSUI_MAILBOX 64829 +#define IDS_CPSUI_COPY 64830 +#define IDS_CPSUI_COPIES 64831 +#define IDS_CPSUI_TOTAL 64832 +#define IDS_CPSUI_MAKE 64833 +#define IDS_CPSUI_PRINT 64834 +#define IDS_CPSUI_FAX 64835 +#define IDS_CPSUI_PLOT 64836 +#define IDS_CPSUI_SLOW 64837 +#define IDS_CPSUI_FAST 64838 +#define IDS_CPSUI_ROTATED 64839 +#define IDS_CPSUI_RESET 64840 +#define IDS_CPSUI_ALL 64841 +#define IDS_CPSUI_DEVICE 64842 +#define IDS_CPSUI_SETTINGS 64843 +#define IDS_CPSUI_REVERT 64844 +#define IDS_CPSUI_CHANGES 64845 +#define IDS_CPSUI_CHANGED 64846 +#define IDS_CPSUI_WARNING 64847 +#define IDS_CPSUI_ABOUT 64848 +#define IDS_CPSUI_VERSION 64849 +#define IDS_CPSUI_NO_NAME 64850 +#define IDS_CPSUI_SETTING 64851 +#define IDS_CPSUI_DEVICE_SETTINGS 64852 +#define IDS_CPSUI_STDDOCPROPTAB1 64853 +#define IDS_CPSUI_STDDOCPROPTAB2 64854 +#define IDS_CPSUI_PAGEORDER 64855 +#define IDS_CPSUI_FRONTTOBACK 64856 +#define IDS_CPSUI_BACKTOFRONT 64857 +#define IDS_CPSUI_QUALITY_SETTINGS 64858 +#define IDS_CPSUI_QUALITY_DRAFT 64859 +#define IDS_CPSUI_QUALITY_BETTER 64860 +#define IDS_CPSUI_QUALITY_BEST 64861 +#define IDS_CPSUI_QUALITY_CUSTOM 64862 +#define IDS_CPSUI_OUTPUTBIN 64863 +#define IDS_CPSUI_NUP 64864 +#define IDS_CPSUI_NUP_NORMAL 64865 +#define IDS_CPSUI_NUP_TWOUP 64866 +#define IDS_CPSUI_NUP_FOURUP 64867 +#define IDS_CPSUI_NUP_SIXUP 64868 +#define IDS_CPSUI_NUP_NINEUP 64869 +#define IDS_CPSUI_NUP_SIXTEENUP 64870 +#define IDS_CPSUI_SIDE1 64871 +#define IDS_CPSUI_SIDE2 64872 +#define IDS_CPSUI_BOOKLET 64873 +#define IDS_CPSUI_POSTER 64874 +#define IDS_CPSUI_POSTER_2x2 64875 +#define IDS_CPSUI_POSTER_3x3 64876 +#define IDS_CPSUI_POSTER_4x4 64877 +#define IDS_CPSUI_NUP_DIRECTION 64878 +#define IDS_CPSUI_RIGHT_THEN_DOWN 64879 +#define IDS_CPSUI_DOWN_THEN_RIGHT 64880 +#define IDS_CPSUI_LEFT_THEN_DOWN 64881 +#define IDS_CPSUI_DOWN_THEN_LEFT 64882 +#define IDS_CPSUI_MANUAL_DUPLEX 64883 +#define IDS_CPSUI_MANUAL_DUPLEX_ON 64884 +#define IDS_CPSUI_MANUAL_DUPLEX_OFF 64885 +#define IDS_CPSUI_ROT_PORT 64886 +#define IDS_CPSUI_STAPLE 64887 +#define IDS_CPSUI_BOOKLET_EDGE 64888 +#define IDS_CPSUI_BOOKLET_EDGE_LEFT 64889 +#define IDS_CPSUI_BOOKLET_EDGE_RIGHT 64890 +#define IDS_CPSUI_NUP_BORDER 64891 +#define IDS_CPSUI_NUP_BORDERED 64892 +#define IDS_CPSUI_STRID_LAST 64892
/* TYPES */ -typedef DWORD (CALLBACK *PFNCOMPROPSHEET)(HANDLE, UINT, LPARAM, LPARAM); +typedef LONG_PTR (CALLBACK *PFNCOMPROPSHEET)(HANDLE, UINT, LPARAM, LPARAM);
typedef struct _PROPSHEETUI_INFO { WORD cbSize; @@ -50,11 +448,11 @@ typedef struct _PROPSHEETUI_INFO { HANDLE hComPropSheet; PFNCOMPROPSHEET pfnComPropSheet; LPARAM lParamInit; - DWORD UserData; - DWORD Result; - } PROPSHEETUI_INFO, *PPROPSHEETUI_INFO; + ULONG_PTR UserData; + ULONG_PTR Result; +} PROPSHEETUI_INFO, *PPROPSHEETUI_INFO;
-typedef LONG (CALLBACK *PFNPROPSHEETUI)(PROPSHEETUI_INFO, LPARAM); +typedef LONG (CALLBACK *PFNPROPSHEETUI)(PROPSHEETUI_INFO*, LPARAM);
/* FUNCTIONS */ LONG WINAPI CommonPropertySheetUIA(HWND, PFNPROPSHEETUI, LPARAM, LPDWORD);
From: Piotr Caban piotr@codeweavers.com
--- dlls/compstui/Makefile.in | 3 + dlls/compstui/compstui.rc | 31 +++ dlls/compstui/compstui_main.c | 358 +++++++++++++++++++++++++++++++++- 3 files changed, 389 insertions(+), 3 deletions(-) create mode 100644 dlls/compstui/compstui.rc
diff --git a/dlls/compstui/Makefile.in b/dlls/compstui/Makefile.in index 5d265611cbe..d382007c35d 100644 --- a/dlls/compstui/Makefile.in +++ b/dlls/compstui/Makefile.in @@ -1,7 +1,10 @@ MODULE = compstui.dll IMPORTLIB = compstui +DELAYIMPORTS = comctl32 user32
EXTRADLLFLAGS = -Wb,--prefer-native
C_SRCS = \ compstui_main.c + +RC_SRCS = compstui.rc diff --git a/dlls/compstui/compstui.rc b/dlls/compstui/compstui.rc new file mode 100644 index 00000000000..9866d2924a5 --- /dev/null +++ b/dlls/compstui/compstui.rc @@ -0,0 +1,31 @@ +/* + * Copyright 2022 Piotr Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <windows.h> +#include <ddk/compstui.h> + +#pragma makedep po + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +STRINGTABLE +{ + IDS_CPSUI_PROPERTIES "Properties" + IDS_CPSUI_OPTIONS "Options" + IDS_CPSUI_DEFAULT "Default" +} diff --git a/dlls/compstui/compstui_main.c b/dlls/compstui/compstui_main.c index 96ca3343963..b7a08e1c52b 100644 --- a/dlls/compstui/compstui_main.c +++ b/dlls/compstui/compstui_main.c @@ -18,19 +18,364 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
+#include <assert.h> #include <stdarg.h> +#include <stdlib.h> +#include <string.h>
#define COBJMACROS
#include "windef.h" #include "winbase.h" #include "winuser.h" +#include "prsht.h" #include "ddk/compstui.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(compstui);
+static HMODULE compstui_hmod; + +typedef struct +{ + WORD size; + WORD flags; + union + { + WCHAR *titleW; + char *titleA; + }; + HWND parent; + HINSTANCE hinst; + union + { + HICON hicon; + ULONG_PTR icon_id; + }; +} PROPSHEETUI_INFO_HEADERAW; + +struct propsheet +{ + int pages_cnt; + HANDLE pages[100]; +}; + +struct propsheetpage +{ + HPROPSHEETPAGE hpsp; +}; + +#define HANDLE_FIRST 0x43440001 +static struct cps_data +{ + enum + { + HANDLE_FREE = 0, + HANDLE_PROPSHEET, + HANDLE_PROPSHEETPAGE + } type; + union + { + void *data; + struct cps_data *next_free; + struct propsheet *ps; + struct propsheetpage *psp; + }; +} handles[0x1000]; +static struct cps_data *first_free_handle = handles; + +static CRITICAL_SECTION handles_cs; +static CRITICAL_SECTION_DEBUG handles_cs_debug = +{ + 0, 0, &handles_cs, + { &handles_cs_debug.ProcessLocksList, &handles_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": handles_cs") } +}; +static CRITICAL_SECTION handles_cs = { &handles_cs_debug, -1, 0, 0, 0, 0 }; + +static struct cps_data* get_handle_data(HANDLE handle) +{ + struct cps_data *ret; + + if ((ULONG_PTR)handle < HANDLE_FIRST || (ULONG_PTR)handle >= HANDLE_FIRST + ARRAY_SIZE(handles)) + return NULL; + + ret = &handles[(ULONG_PTR)handle - HANDLE_FIRST]; + return ret->type == HANDLE_FREE ? NULL : ret; +} + +static HANDLE alloc_handle(struct cps_data **cps_data, int type) +{ + void *data = NULL; + + switch(type) + { + case HANDLE_PROPSHEET: + data = calloc(1, sizeof(struct propsheet)); + break; + case HANDLE_PROPSHEETPAGE: + data = calloc(1, sizeof(struct propsheetpage)); + break; + } + + if (!data) + return NULL; + + EnterCriticalSection(&handles_cs); + + if (first_free_handle >= handles + ARRAY_SIZE(handles)) + { + LeaveCriticalSection(&handles_cs); + FIXME("out of handles\n"); + free(data); + return NULL; + } + + *cps_data = first_free_handle; + if ((*cps_data)->next_free) + first_free_handle = (*cps_data)->next_free; + else + first_free_handle = (*cps_data) + 1; + LeaveCriticalSection(&handles_cs); + + (*cps_data)->type = type; + (*cps_data)->data = data; + return (HANDLE)(HANDLE_FIRST + ((*cps_data) - handles)); +} + +static void free_handle(HANDLE handle) +{ + struct cps_data *data = get_handle_data(handle); + + if (!data) + return; + + data->type = HANDLE_FREE; + free(data->data); + + EnterCriticalSection(&handles_cs); + data->next_free = first_free_handle; + first_free_handle = data; + LeaveCriticalSection(&handles_cs); +} + +static HANDLE add_hpropsheetpage(HANDLE hcps, HPROPSHEETPAGE hpsp) +{ + struct cps_data *cps_data = get_handle_data(hcps); + struct cps_data *cpsp_data; + HANDLE ret; + + if (!cps_data || !hpsp) + return 0; + + if (cps_data->type != HANDLE_PROPSHEET) + { + FIXME("unsupported handle type %d\n", cps_data->type); + return 0; + } + + if (cps_data->ps->pages_cnt == ARRAY_SIZE(cps_data->ps->pages)) + return 0; + + ret = alloc_handle(&cpsp_data, HANDLE_PROPSHEETPAGE); + if (!ret) + return 0; + cpsp_data->psp->hpsp = hpsp; + + cps_data->ps->pages[cps_data->ps->pages_cnt++] = ret; + return ret; +} + +static LONG_PTR WINAPI cps_callback(HANDLE hcps, UINT func, LPARAM lparam1, LPARAM lparam2) +{ + TRACE("(%p, %u, %Ix, %Ix\n", hcps, func, lparam1, lparam2); + + switch(func) + { + case CPSFUNC_ADD_HPROPSHEETPAGE: + return (LONG_PTR)add_hpropsheetpage(hcps, (HPROPSHEETPAGE)lparam1); + case CPSFUNC_ADD_PROPSHEETPAGEW: + case CPSFUNC_ADD_PCOMPROPSHEETUIA: + case CPSFUNC_ADD_PCOMPROPSHEETUIW: + case CPSFUNC_ADD_PFNPROPSHEETUIA: + case CPSFUNC_ADD_PFNPROPSHEETUIW: + case CPSFUNC_DELETE_HCOMPROPSHEET: + case CPSFUNC_SET_HSTARTPAGE: + case CPSFUNC_GET_PAGECOUNT: + case CPSFUNC_SET_RESULT: + case CPSFUNC_GET_HPSUIPAGES: + case CPSFUNC_LOAD_CPSUI_STRINGA: + case CPSFUNC_LOAD_CPSUI_STRINGW: + case CPSFUNC_LOAD_CPSUI_ICON: + case CPSFUNC_GET_PFNPROPSHEETUI_ICON: + case CPSFUNC_ADD_PROPSHEETPAGEA: + case CPSFUNC_INSERT_PSUIPAGEA: + case CPSFUNC_INSERT_PSUIPAGEW: + case CPSFUNC_SET_PSUIPAGE_TITLEA: + case CPSFUNC_SET_PSUIPAGE_TITLEW: + case CPSFUNC_SET_PSUIPAGE_ICON: + case CPSFUNC_SET_DATABLOCK: + case CPSFUNC_QUERY_DATABLOCK: + case CPSFUNC_SET_DMPUB_HIDEBITS: + case CPSFUNC_IGNORE_CPSUI_PSN_APPLY: + case CPSFUNC_DO_APPLY_CPSUI: + case CPSFUNC_SET_FUSION_CONTEXT: + FIXME("func not supported %d\n", func); + return 0; + default: + ERR("unknown func: %d\n", func); + return 0; + } +} + +static LONG create_property_sheetW(struct propsheet *ps, PROPSHEETUI_INFO_HEADERAW *header) +{ + HPROPSHEETPAGE hpsp[100]; + PROPSHEETHEADERW psh; + WCHAR title[256]; + LONG_PTR ret; + int i, len; + + if (!ps->pages_cnt) + return ERR_CPSUI_NO_PROPSHEETPAGE; + + memset(&psh, 0, sizeof(psh)); + psh.dwSize = sizeof(psh); + if (header->flags & PSUIHDRF_NOAPPLYNOW) + psh.dwFlags |= PSH_NOAPPLYNOW; + psh.hwndParent = header->parent; + psh.hInstance = header->hinst; + psh.pszCaption = title; + + if (!(header->flags & PSUIHDRF_USEHICON) && !header->icon_id) + header->icon_id = IDI_CPSUI_OPTION; + + if (header->flags & PSUIHDRF_USEHICON) + { + psh.dwFlags |= PSH_USEHICON; + psh.hIcon = header->hicon; + } + else if (header->icon_id >= IDI_CPSUI_ICONID_FIRST && + header->icon_id <= IDI_CPSUI_ICONID_LAST) + { + FIXME("icon not implemented: %Id\n", header->icon_id); + } + else + { + psh.dwFlags |= PSH_USEICONID; + psh.pszIcon = (WCHAR*)header->icon_id; + } + + if (header->titleW) + wcscpy_s(title, ARRAY_SIZE(title), header->titleW); + else + LoadStringW(compstui_hmod, IDS_CPSUI_OPTIONS, title, ARRAY_SIZE(title)); + + if ((header->flags & PSUIHDRF_DEFTITLE) && + (!header->titleW || !(header->flags & PSUIHDRF_EXACT_PTITLE))) + { + len = wcslen(title); + if (len < ARRAY_SIZE(title)) + title[len++] = ' '; + LoadStringW(compstui_hmod, IDS_CPSUI_DEFAULT, title + len, ARRAY_SIZE(title) - len); + } + + if ((header->flags & PSUIHDRF_PROPTITLE) && + (!header->titleW || !(header->flags & PSUIHDRF_EXACT_PTITLE))) + { + len = wcslen(title); + if (len < ARRAY_SIZE(title)) + title[len++] = ' '; + LoadStringW(compstui_hmod, IDS_CPSUI_PROPERTIES, title + len, ARRAY_SIZE(title) - len); + } + + psh.nPages = ps->pages_cnt; + psh.phpage = hpsp; + for (i = 0; i < ps->pages_cnt; i++) + hpsp[i] = get_handle_data(ps->pages[i])->psp->hpsp; + + ret = PropertySheetW(&psh); + + switch(ret) + { + case -1: + return ERR_CPSUI_GETLASTERROR; + case ID_PSREBOOTSYSTEM: + return CPSUI_REBOOTSYSTEM; + case ID_PSRESTARTWINDOWS: + return CPSUI_RESTARTWINDOWS; + default: + return CPSUI_OK; + } +} + +static LONG create_prop_dlg(HWND hwnd, PFNPROPSHEETUI callback, LPARAM lparam, DWORD *res, BOOL unicode) +{ + PROPSHEETUI_INFO info, callback_info; + PROPSHEETUI_INFO_HEADERAW header; + struct cps_data *cps_data; + HANDLE cps_handle; + LONG ret; + int i; + + if (!callback || !(cps_handle = alloc_handle(&cps_data, HANDLE_PROPSHEET))) + { + SetLastError(0); + return ERR_CPSUI_GETLASTERROR; + } + + memset(&info, 0, sizeof(info)); + info.cbSize = sizeof(info); + info.lParamInit = lparam; + callback_info = info; + callback_info.Reason = PROPSHEETUI_REASON_BEFORE_INIT; + callback(&callback_info, lparam); + + info.Version = PROPSHEETUI_INFO_VERSION; + info.Flags = unicode ? PSUIINFO_UNICODE : 0; + info.hComPropSheet = cps_handle; + info.pfnComPropSheet = cps_callback; + callback_info = info; + callback_info.Reason = PROPSHEETUI_REASON_INIT; + ret = callback(&callback_info, lparam); + info.UserData = callback_info.UserData; + info.Result = callback_info.Result; + if (ret <= 0) + { + ret = ERR_CPSUI_GETLASTERROR; + goto destroy; + } + + memset(&header, 0, sizeof(header)); + header.size = sizeof(header); + header.parent = hwnd; + callback_info = info; + callback_info.Reason = PROPSHEETUI_REASON_GET_INFO_HEADER; + ret = callback(&callback_info, (LPARAM)&header); + info.UserData = callback_info.UserData; + info.Result = callback_info.Result; + if (ret <= 0) + { + ret = ERR_CPSUI_GETLASTERROR; + goto destroy; + } + + ret = create_property_sheetW(cps_data->ps, &header); + +destroy: + callback_info = info; + callback_info.Reason = PROPSHEETUI_REASON_DESTROY; + callback(&callback_info, ret < 0 ? 0 : 0x100); + + for (i = 0; i < cps_data->ps->pages_cnt; i++) + free_handle(cps_data->ps->pages[i]); + free_handle(cps_handle); + + if (res) *res = callback_info.Result; + return ret; +} + /****************************************************************** * CommonPropertySheetUIA (COMPSTUI.@) * @@ -45,10 +390,10 @@ LONG WINAPI CommonPropertySheetUIA(HWND hWnd, PFNPROPSHEETUI pfnPropSheetUI, LPA * CommonPropertySheetUIW (COMPSTUI.@) * */ -LONG WINAPI CommonPropertySheetUIW(HWND hWnd, PFNPROPSHEETUI pfnPropSheetUI, LPARAM lparam, LPDWORD pResult) +LONG WINAPI CommonPropertySheetUIW(HWND hwnd, PFNPROPSHEETUI callback, LPARAM lparam, LPDWORD res) { - FIXME("(%p, %p, 0x%Ix, %p)\n", hWnd, pfnPropSheetUI, lparam, pResult); - return CPSUI_CANCEL; + TRACE("(%p, %p, 0x%Ix, %p)\n", hwnd, callback, lparam, res); + return create_prop_dlg(hwnd, callback, lparam, res, TRUE); }
/****************************************************************** @@ -70,3 +415,10 @@ BOOL WINAPI SetCPSUIUserData(HWND hDlg, ULONG_PTR UserData ) FIXME("(%p, %08Ix): stub\n", hDlg, UserData); return TRUE; } + +BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved) +{ + if (reason == DLL_PROCESS_ATTACH) + compstui_hmod = hinst; + return TRUE; +}
From: Piotr Caban piotr@codeweavers.com
--- configure | 1 + configure.ac | 1 + dlls/compstui/tests/Makefile.in | 7 ++ dlls/compstui/tests/compstui.c | 153 ++++++++++++++++++++++++++++++++ dlls/compstui/tests/rsrc.rc | 28 ++++++ 5 files changed, 190 insertions(+) create mode 100644 dlls/compstui/tests/Makefile.in create mode 100644 dlls/compstui/tests/compstui.c create mode 100644 dlls/compstui/tests/rsrc.rc
diff --git a/configure b/configure index 8585cf11b1f..89500dc8f7a 100755 --- a/configure +++ b/configure @@ -21296,6 +21296,7 @@ wine_fn_config_makefile dlls/comm.drv16 enable_win16 wine_fn_config_makefile dlls/commdlg.dll16 enable_win16 wine_fn_config_makefile dlls/compobj.dll16 enable_win16 wine_fn_config_makefile dlls/compstui enable_compstui +wine_fn_config_makefile dlls/compstui/tests enable_tests wine_fn_config_makefile dlls/comsvcs enable_comsvcs wine_fn_config_makefile dlls/comsvcs/tests enable_tests wine_fn_config_makefile dlls/concrt140 enable_concrt140 diff --git a/configure.ac b/configure.ac index c41f84ae1f2..49d414e1d17 100644 --- a/configure.ac +++ b/configure.ac @@ -2435,6 +2435,7 @@ WINE_CONFIG_MAKEFILE(dlls/comm.drv16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/commdlg.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/compobj.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/compstui) +WINE_CONFIG_MAKEFILE(dlls/compstui/tests) WINE_CONFIG_MAKEFILE(dlls/comsvcs) WINE_CONFIG_MAKEFILE(dlls/comsvcs/tests) WINE_CONFIG_MAKEFILE(dlls/concrt140) diff --git a/dlls/compstui/tests/Makefile.in b/dlls/compstui/tests/Makefile.in new file mode 100644 index 00000000000..8904782645f --- /dev/null +++ b/dlls/compstui/tests/Makefile.in @@ -0,0 +1,7 @@ +TESTDLL = compstui.dll +IMPORTS = comctl32 compstui user32 + +C_SRCS = \ + compstui.c + +RC_SRCS = rsrc.rc diff --git a/dlls/compstui/tests/compstui.c b/dlls/compstui/tests/compstui.c new file mode 100644 index 00000000000..f4e3af459a9 --- /dev/null +++ b/dlls/compstui/tests/compstui.c @@ -0,0 +1,153 @@ +/* + * Copyright 2022 Piotr Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <windows.h> +#include <prsht.h> +#include <ddk/compstui.h> + +#include "wine/test.h" + +typedef struct { + WORD cbSize; + WORD Flags; + LPWSTR pTitle; + HWND hWndParent; + HINSTANCE hInst; + union { + HICON hIcon; + ULONG_PTR IconID; + }; +} PROPSHEETUI_INFO_HEADERW; + +static INT_PTR CALLBACK prop_page_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +{ + if (msg == WM_INITDIALOG) + { + HWND dlg = GetParent(hwnd); + + PostMessageW(dlg, PSM_PRESSBUTTON, PSBTN_OK, 0); + } + return FALSE; +} + +#define ADD_PAGES 0x1 + +static LONG WINAPI propsheetui_callback(PROPSHEETUI_INFO *info, LPARAM lparam) +{ + PROPSHEETUI_INFO_HEADERW *info_header; + + ok(info->cbSize == sizeof(*info), "info->cbSize = %hd\n", info->cbSize); + + switch(info->Reason) + { + case PROPSHEETUI_REASON_BEFORE_INIT: + ok(!info->Version, "info->Version = %hd\n", info->Version); + ok(!info->Flags, "info->Flags = %hd\n", info->Flags); + ok(!info->hComPropSheet, "info->hComPropSheet = %p\n", info->hComPropSheet); + ok(!info->pfnComPropSheet, "info->pfnComPropSheet = %p\n", info->pfnComPropSheet); + ok(!info->Result, "info->Result = %Ix\n", info->Result); + break; + case PROPSHEETUI_REASON_INIT: + ok(info->Version == PROPSHEETUI_INFO_VERSION, "info->Version = %hd\n", info->Version); + ok(info->Flags == PSUIINFO_UNICODE, "info->Flags = %hd\n", info->Flags); + ok(info->hComPropSheet != NULL, "info->hComPropSheet = NULL\n"); + ok(info->pfnComPropSheet != NULL, "info->pfnComPropSheet = NULL\n"); + ok(!info->UserData, "info->UserData = %Ix\n", info->UserData); + ok(!info->Result, "info->Result = %Ix\n", info->Result); + break; + case PROPSHEETUI_REASON_GET_INFO_HEADER: + ok(info->Version == PROPSHEETUI_INFO_VERSION, "info->Version = %hd\n", info->Version); + ok(info->Flags == PSUIINFO_UNICODE, "info->Flags = %hd\n", info->Flags); + ok(info->hComPropSheet != NULL, "info->hComPropSheet = NULL\n"); + ok(info->pfnComPropSheet != NULL, "info->pfnComPropSheet = NULL\n"); + ok(!info->UserData, "info->UserData = %Ix\n", info->UserData); + ok(!info->Result, "info->Result = %Ix\n", info->Result); + + info_header = (PROPSHEETUI_INFO_HEADERW*)lparam; + ok(info_header->cbSize == sizeof(*info_header), "info_header->cbSize = %hd\n", info_header->cbSize); + ok(!info_header->Flags, "info_header->Flags = %hx\n", info_header->Flags); + ok(!info_header->pTitle, "info_header->pTitle = %p\n", info_header->pTitle); + ok(info_header->hWndParent == (HWND)0x4321, "info_header->hWndParent = %p\n", info_header->hWndParent); + ok(!info_header->hInst, "info_header->hInst = %p\n", info_header->hInst); + + info_header->hWndParent = 0; + + if (info->lParamInit & ADD_PAGES) + { + HPROPSHEETPAGE hpsp; + PROPSHEETPAGEW psp; + LONG_PTR ret; + + memset(&psp, 0, sizeof(psp)); + psp.dwSize = sizeof(psp); + U(psp).pszTemplate = L"prop_page1"; + psp.pfnDlgProc = prop_page_proc; + hpsp = CreatePropertySheetPageW(&psp); + ok(hpsp != NULL, "hpsp = %p\n", hpsp); + ret = info->pfnComPropSheet(info->hComPropSheet, CPSFUNC_ADD_HPROPSHEETPAGE, (LPARAM)hpsp, 0); + ok(ret, "ret = 0\n"); + } + break; + case PROPSHEETUI_REASON_DESTROY: + if (info->lParamInit & ADD_PAGES) + ok(lparam, "lparam = 0\n"); + else + ok(!lparam, "lparam = %Ix\n", lparam); + + ok(info->Version == PROPSHEETUI_INFO_VERSION, "info->Version = %hd\n", info->Version); + ok(info->Flags == PSUIINFO_UNICODE, "info->Flags = %hd\n", info->Flags); + ok(info->hComPropSheet != NULL, "info->hComPropSheet = NULL\n"); + ok(info->pfnComPropSheet != NULL, "info->pfnComPropSheet = NULL\n"); + ok(!info->UserData, "info->UserData = %Ix\n", info->UserData); + ok(!info->Result, "info->Result = %Ix\n", info->Result); + break; + default: + ok(0, "unhandled info->Reason = %hd\n", info->Reason); + break; + } + + return 1; +} + +static void test_CommonPropertySheetUI(void) +{ + DWORD res; + LONG ret; + + SetLastError(0xdeadbeef); + res = 0xdeadbeef; + ret = CommonPropertySheetUIW(0, NULL, 0, &res); + ok(ret == ERR_CPSUI_GETLASTERROR, "ret = %ld\n", ret); + ok(res == 0xdeadbeef, "res = %lx\n", res); + ok(!GetLastError(), "CommonPropertySheetUIW error %ld\n", GetLastError()); + + res = 0xdeadbeef; + ret = CommonPropertySheetUIW((HWND)0x4321, propsheetui_callback, 0, &res); + ok(ret == ERR_CPSUI_NO_PROPSHEETPAGE, "CommonPropertySheetUIW returned %ld\n", ret); + ok(!res, "res = %lx\n", res); + + res = 0xdeadbeef; + ret = CommonPropertySheetUIW((HWND)0x4321, propsheetui_callback, ADD_PAGES, &res); + ok(ret == CPSUI_OK, "CommonPropertySheetUIW returned %ld\n", ret); + ok(!res, "res = %lx\n", res); +} + +START_TEST(compstui) +{ + test_CommonPropertySheetUI(); +} diff --git a/dlls/compstui/tests/rsrc.rc b/dlls/compstui/tests/rsrc.rc new file mode 100644 index 00000000000..141fe606a3c --- /dev/null +++ b/dlls/compstui/tests/rsrc.rc @@ -0,0 +1,28 @@ +/* + * Copyright 2022 Piotr Caban + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "windef.h" +#include "winuser.h" + +PROP_PAGE1 DIALOG 0, 0, 120, 60 +STYLE WS_POPUP | WS_CAPTION | WS_CLIPSIBLINGS | WS_VISIBLE +CAPTION "Page1" +FONT 8, "MS Shell Dlg" +{ + LTEXT "Test", 10, 10, 6, 100, 8 +}