• R/O
  • HTTP
  • SSH
  • HTTPS

source: 提交


Commit MetaInfo

修訂06b23668d5d7d144a8092d912f3e4bb853fc66b8 (tree)
時間2022-11-03 21:17:16
作者SHIRAKATA Kentaro <argrath@ub32...>
CommiterSHIRAKATA Kentaro

Log Message

remove files no longer used

Change Summary

  • delete: sys/winnt/defaults.nh
  • delete: sys/winnt/sysconf
  • delete: win/win32/winhack.c

差異

--- a/sys/winnt/defaults.nh
+++ /dev/null
@@ -1,198 +0,0 @@
1-# NetHack 3.6 defaults.nh $NHDT-Date: 1524689357 2018/04/25 20:49:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.32 $
2-# Copyright (c) 2006 by Michael Allison
3-# NetHack may be freely redistributed. See license for details.
4-
5-# Sample config file for win32 NetHack
6-# A '#' at the beginning of a line means the rest of the line is a comment.
7-#
8-# Some options MUST be set in this file, other options can be toggled while
9-# playing. For a list of options available see the <opthelp.> file.
10-#
11-# To change the configuration, comment out the unwanted lines, and
12-# uncomment the configuration you want.
13-#
14-# $NHDT-Date: 1524689357 2018/04/25 20:49:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.32 $
15-
16-# *** OPTIONS ***
17-#
18-# Use the IBM character set rather than just plain ascii characters
19-# for tty window-port.
20-OPTIONS=symset:default,roguesymset:default
21-
22-# Here is a suggested symbol set from Michael Feir,
23-# for use by blind NetHack players
24-#OPTIONS=symset:NHAccess,roguesymset:NHAccess
25-
26-# Optional curses port interface
27-#OPTIONS=windowtype:curses
28-#
29-# Keyboard handling
30-# Different keyboard handlers can be loaded.
31-# Default is nhdefkey.dll but you can override that.
32-# Ray Chason's keyboard handler
33-# OPTIONS=altkeyhandler:nhraykey.dll
34-#
35-# NetHack 3.4.0 keyboard handling
36-# OPTIONS=altkeyhandler:nh340key.dll
37-
38-# *** Personal Preferences ***
39-# Some options to set personal preferences. Uncomment and change these to
40-# suit your personal preference. If several people are to use the same
41-# configuration, options like these should not be set.
42-#
43-#OPTIONS=name:Janet,role:Valkyrie,race:Human,gender:female,align:lawful
44-#OPTIONS=dogname:Fido,catname:Morris,fruit:guava
45-#OPTIONS=horsename:Silver
46-
47-# Disable autopickup
48-OPTIONS=!autopickup
49-
50-# When autopickup is on, automatically pick up these types of objects
51-#OPTIONS=pickup_types:$"=/!?+
52-
53-#OPTIONS=packorder:")[%?+/=!(*0_`
54-#OPTIONS=scores:10 top/2 around/own
55-#OPTIONS=nolegacy,noverbose
56-#OPTIONS=menustyle:traditional
57-#OPTIONS=perm_invent
58-
59-
60-# Highlight menu lines with different colors. You need to define the colors
61-# with MENUCOLOR lines.
62-# Toggle menucolor use on or off
63-OPTIONS=menucolors
64-# Define color used for a certain menu line. Format is
65-# MENUCOLOR="regular expression"=color
66-# or
67-# MENUCOLOR="regular expression"=color&attribute
68-# Show all blessed items in green
69-MENUCOLOR=" blessed " = green
70-# Show all holy water in green
71-MENUCOLOR=" holy " = green
72-# Show all cursed items in red
73-MENUCOLOR=" cursed " = red
74-# Show all unholy water in red
75-MENUCOLOR=" unholy " = red
76-# Show all cursed worn items in orange and underlined
77-MENUCOLOR=" cursed .* (being worn)" = orange&underline
78-
79-
80-
81-# General options. You might also set "silent" so as not to attract
82-# the boss's attention.
83-#
84-# number_pad option can have an optional value of 0 (off), 1 (on),
85-# or 2(on,legacy-mode) which causes 5='g', alt-5='G', alt-0='I'
86-OPTIONS=time,noshowexp,number_pad:2,lit_corridor,mouse_support:1
87-
88-# Make commands that ask for an inventory item pop up a menu
89-OPTIONS=force_invmenu
90-
91-#
92-# If you want to get rid of "use #quit to quit..." use:
93-OPTIONS=suppress_alert:3.3.1
94-#
95-# Note: the rest_on_space in the next line may not be
96-# appropriate for a beginning NetHack player, since
97-# it could result in use of a turn unintentionally.
98-# If you're new to NetHack, leave it commented it out.
99-#OPTIONS=rest_on_space
100-#
101-# Set some options to control graphical window-port (these will
102-# be safely and silently ignored by the tty port)
103-#
104-# Map window settings
105-# possible map_mode options include: tiles|ascii4x6|ascii6x8|ascii8x8|ascii16x8|
106-# ascii7x12|ascii8x12|ascii16x12|ascii12x16|
107-# ascii10x18|fit_to_screen
108-OPTIONS=map_mode:tiles,scroll_margin:10
109-
110-# Message window settings
111-#OPTIONS=font_message:Arial,font_size_message:14,align_message:top
112-
113-# Menu settings
114-#OPTIONS=font_menu:Arial,font_size_menu:14
115-
116-# Text settings
117-#OPTIONS=font_text:Courier New,font_size_text:14
118-
119-# Status window settings
120-#OPTIONS=font_status:Courier New,font_size_status:14
121-
122-# Other
123-OPTIONS=hilite_pet,!toptenwin
124-#OPTIONS=!splash_screen,player_selection:prompts
125-
126-# Status/message window colors
127-# Possible color options include:
128-# six digit hexadecimal RGB color value ("#8F8F8F"), black, red, green, brown,
129-# blue, magenta, cyan, gray (or grey), orange, brightgreen, yellow, brightblue,
130-# brightmagenta, brightcyan, white, trueblack, purple, silver, maroon, fuchsia,
131-# lime, olive, navy, teal, aqua, activeborder, activecaption, appworkspace,
132-# background, btnface, btnshadow, btntext, captiontext, graytext, highlight,
133-# highlighttext, inactiveborder, inactivecaption, menu, menutext, scrollbar,
134-# window, windowframe, windowtext.
135-#OPTIONS=windowcolors:status windowtext/window message windowtext/window
136-
137-# "Nethack mode" colors
138-OPTIONS=windowcolors:status white/#000000 message white/#000000 text white/#000000 menu white/#000000 menutext white/#000000
139-OPTIONS=vary_msgcount:4
140-
141-# *** LOCATIONS ***
142-# IMPORTANT: If you change any of these locations, the directories they
143-# point at must exist. NetHack will not create them for you.
144-#
145-# HACKDIR is the default location for everything.
146-# Note: On Windows HACKDIR defaults to the location
147-# of the NetHack.exe or NetHackw.exe file so
148-# setting HACKDIR below to override that is
149-# not usually necessary or recommended.
150-#HACKDIR=c:\games\nethack
151-#
152-# The location that level files in progress are stored (default=HACKDIR, writeable)
153-#LEVELDIR=c:\nethack\levels
154-#
155-# The location where saved games are kept (default=HACKDIR, writeable)
156-#SAVEDIR=c:\nethack\save
157-#
158-# The location that bones files are kept (default=HACKDIR, writeable)
159-#BONESDIR=c:\nethack\save
160-#
161-# The location that file synchronization locks are stored (default=HACKDIR, writeable)
162-#LOCKDIR=c:\nethack\levels
163-#
164-# The location that a record of game aborts and self-diagnosed game problems
165-# is kept (default=HACKDIR, writeable)
166-#TROUBLEDIR=c:\nethack\trouble
167-
168-# Finnish keyboards might need these modifications uncommented.
169-# For \, @, $, [, |
170-#OPTIONS=subkeyvalue:171/92
171-#OPTIONS=subkeyvalue:178/64
172-#OPTIONS=subkeyvalue:180/36
173-#OPTIONS=subkeyvalue:184/91
174-#OPTIONS=subkeyvalue:188/124
175-
176-#
177-# Some versions of Windows allow you to adjust the win32 console port
178-# colors using R-G-B settings.
179-#
180-#OPTIONS=palette:black-0-0-0
181-#OPTIONS=palette:red-210-0-0
182-#OPTIONS=palette:green-80-200-0
183-#OPTIONS=palette:brown-180-100-0
184-#OPTIONS=palette:blue-0-0-200
185-#OPTIONS=palette:magenta-128-0-128
186-#OPTIONS=palette:cyan-50-180-180
187-#OPTIONS=palette:gray-192-192-192
188-#OPTIONS=palette:dark gray-100-100-100
189-#OPTIONS=palette:orange-255-128-0
190-#OPTIONS=palette:bright green-0-255-0
191-#OPTIONS=palette:yellow-255-255-0
192-#OPTIONS=palette:bright blue-100-100-240
193-#OPTIONS=palette:bright magenta-255-0-255
194-#OPTIONS=palette:bright cyan-0-255-255
195-#OPTIONS=palette:white-255-255-255
196-
197-
198-
--- a/sys/winnt/sysconf
+++ /dev/null
@@ -1,101 +0,0 @@
1-#
2-# NetHack 3.6 sysconf $NHDT-Date: 1524689357 2018/04/25 20:49:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.22 $
3-# Copyright (c) 2015 by Michael Allison
4-# NetHack may be freely redistributed. See license for details.
5-#
6-# Sample sysconf file.
7-# The sysconf file is only used if NetHack is compiled with SYSCF defined.
8-# This file uses the same syntax as nethack.cf.
9-
10-# Which users can use WIZARD (debugging) mode (the -D flag).
11-# A value of * allows anyone to enter debugging mode.
12-WIZARDS=*
13-
14-# Users allowed to use the ! (shell escape) command or to suspend the game.
15-# Uses the same syntax as the WIZARDS option above.
16-#SHELLERS=
17-
18-# Show debugging information originating from these source files.
19-# Use '*' for all, or list source files separated by spaces.
20-# Only available if game has been compiled with DEBUG.
21-#DEBUGFILES=*
22-
23-# Save end of game dump log to this file.
24-# Only available if NetHack was compiled with DUMPLOG
25-# Allows following placeholders:
26-# %% literal '%'
27-# %v version (eg. "3.6.2-0")
28-# %u game UID
29-# %t game start time, UNIX timestamp format
30-# %T current time, UNIX timestamp format
31-# %d game start time, YYYYMMDDhhmmss format
32-# %D current time, YYYYMMDDhhmmss format
33-# %n player name
34-# %N first character of player name
35-#DUMPLOGFILE=nethack-%n-%d.log
36-
37-# Number of bones file pools.
38-# The pool you belong to is determined at game start. You will
39-# load and save bones only from that pool. Generally useful
40-# for public servers only.
41-# Changing this might make existing bones inaccessible.
42-# Disabled by setting to 0, or commenting out.
43-#BONES_POOLS=10
44-
45-# Limit the number of simultaneous games (see also nethack.sh).
46-#MAXPLAYERS=10
47-
48-# If not null, added to string "To get local support, " in the support
49-# information help.
50-#SUPPORT=call Izchak at extension 42.
51-
52-# Uncomment the next line to disable the SEDUCE option.
53-#SEDUCE=0
54-
55-# Record (high score) file options.
56-# CAUTION: changing these after people have started playing games can
57-# lead to lost high scores!
58-# Maximum entries for one person.
59-#PERSMAX=10
60-# Maximum entries in the record file.
61-#ENTRYMAX=100
62-# Minimum points to get an entry.
63-#POINTSMIN=1
64-# Determine identity of "person" in the score file with name (0) or
65-# numeric (1) user id.
66-#PERS_IS_UID=1
67-
68-# Maximum number of score file entries to use for random statue names
69-#MAX_STATUENAME_RANK=10
70-
71-# *** LOCATIONS ***
72-# IMPORTANT: If you change any of these locations, the directories they
73-# point at must exist. NetHack will not create them for you.
74-#
75-# HACKDIR is the default location for everything.
76-# Note: On Windows HACKDIR defaults to the location
77-# of the NetHack.exe or NetHackw.exe file so
78-# setting HACKDIR below to override that is
79-# not usually necessary or recommended.
80-#HACKDIR=c:\games\nethack
81-#
82-# The location that users can adjust their config file startup options
83-#CONFIGDIR=c:\games\nethack
84-#
85-# The location that level files in progress are stored (default=HACKDIR, writeable)
86-#LEVELDIR=c:\nethack\levels
87-#
88-# The location where saved games are kept (default=HACKDIR, writeable)
89-#SAVEDIR=c:\nethack\save
90-#
91-# The location that bones files are kept (default=HACKDIR, writeable)
92-#BONESDIR=c:\nethack\save
93-#
94-# The location that file synchronization locks are stored (default=HACKDIR, writeable)
95-#LOCKDIR=c:\nethack\levels
96-#
97-# The location that a record of game aborts and self-diagnosed game problems
98-# is kept (default=HACKDIR, writeable)
99-#TROUBLEDIR=c:\nethack\trouble
100-
101-
--- a/win/win32/winhack.c
+++ /dev/null
@@ -1,427 +0,0 @@
1-/* NetHack 3.6 winhack.c $NHDT-Date: 1449488876 2015/12/07 11:47:56 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.44 $ */
2-/* Copyright (C) 2001 by Alex Kompel */
3-/* NetHack may be freely redistributed. See license for details. */
4-
5-// winhack.cpp : Defines the entry point for the application.
6-//
7-
8-#include "win10.h"
9-#include <process.h>
10-
11-#include "winMS.h"
12-#include "hack.h"
13-#include "dlb.h"
14-#include "resource.h"
15-#include "mhmain.h"
16-#include "mhmap.h"
17-
18-#if !defined(SAFEPROCS)
19-#error You must #define SAFEPROCS to build winhack.c
20-#endif
21-
22-/* Borland and MinGW redefine "boolean" in shlwapi.h,
23- so just use the little bit we need */
24-typedef struct _DLLVERSIONINFO {
25- DWORD cbSize;
26- DWORD dwMajorVersion; // Major version
27- DWORD dwMinorVersion; // Minor version
28- DWORD dwBuildNumber; // Build number
29- DWORD dwPlatformID; // DLLVER_PLATFORM_*
30-} DLLVERSIONINFO;
31-
32-//
33-// The caller should always GetProcAddress("DllGetVersion"), not
34-// implicitly link to it.
35-//
36-
37-typedef HRESULT(CALLBACK *DLLGETVERSIONPROC)(DLLVERSIONINFO *);
38-
39-/* end of shlwapi.h */
40-
41-/* Minimal common control library version
42-Version _WIN_32IE Platform/IE
43-======= ========= ===========
44-4.00 0x0200 Microsoft(r) Windows 95/Windows NT 4.0
45-4.70 0x0300 Microsoft(r) Internet Explorer 3.x
46-4.71 0x0400 Microsoft(r) Internet Explorer 4.0
47-4.72 0x0401 Microsoft(r) Internet Explorer 4.01
48-...and probably going on infinitely...
49-*/
50-#define MIN_COMCTLMAJOR 4
51-#define MIN_COMCTLMINOR 71
52-#define INSTALL_NOTES "http://www.nethack.org/v340/ports/download-win.html#cc"
53-/*#define COMCTL_URL
54- * "http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp"*/
55-
56-extern void FDECL(nethack_exit, (int));
57-static TCHAR *_get_cmd_arg(TCHAR *pCmdLine);
58-static HRESULT GetComCtlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor);
59-BOOL WINAPI
60-_nhapply_image_transparent(HDC hDC, int x, int y, int width, int height,
61- HDC sourceDC, int s_x, int s_y, int s_width,
62- int s_height, UINT cTransparent);
63-
64-// Global Variables:
65-NHWinApp _nethack_app;
66-extern int GUILaunched; /* We tell shared startup code in windmain.c
67- that the GUI was launched via this */
68-
69-#ifdef __BORLANDC__
70-#define _stricmp(s1, s2) stricmp(s1, s2)
71-#define _strdup(s1) strdup(s1)
72-#endif
73-
74-// Foward declarations of functions included in this code module:
75-extern boolean FDECL(main, (int, char **));
76-static void __cdecl mswin_moveloop(void *);
77-
78-#define MAX_CMDLINE_PARAM 255
79-
80-int APIENTRY
81-WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
82- int nCmdShow)
83-{
84- INITCOMMONCONTROLSEX InitCtrls;
85- int argc;
86- char *argv[MAX_CMDLINE_PARAM];
87- size_t len;
88- TCHAR *p;
89- TCHAR wbuf[BUFSZ];
90- char buf[BUFSZ];
91-
92- DWORD major, minor;
93- /* OSVERSIONINFO osvi; */
94-
95- UNREFERENCED_PARAMETER(hPrevInstance);
96- UNREFERENCED_PARAMETER(lpCmdLine);
97- UNREFERENCED_PARAMETER(nCmdShow);
98-
99- /*
100- * Get a set of valid safe windowport function
101- * pointers during early startup initialization.
102- *
103- * When get_safe_procs is called with 0 as the param,
104- * non-functional, but safe function pointers are set
105- * for all windowport routines.
106- *
107- * When get_safe_procs is called with 1 as the param,
108- * raw_print, raw_print_bold, and wait_synch, and nhgetch
109- * are set to use C stdio routines via stdio_raw_print,
110- * stdio_raw_print_bold, stdio_wait_synch, and
111- * stdio_nhgetch.
112- */
113- windowprocs = *get_safe_procs(0);
114-
115- /*
116- * Now we are going to override a couple
117- * of the windowprocs functions so that
118- * error messages are handled in a suitable
119- * way for the graphical version.
120- */
121- windowprocs.win_raw_print = mswin_raw_print;
122- windowprocs.win_raw_print_bold = mswin_raw_print_bold;
123- windowprocs.win_wait_synch = mswin_wait_synch;
124-
125- win10_init();
126- sys_early_init();
127-
128- /* init application structure */
129- _nethack_app.hApp = hInstance;
130- _nethack_app.hAccelTable =
131- LoadAccelerators(hInstance, (LPCTSTR) IDC_NETHACKW);
132- _nethack_app.hMainWnd = NULL;
133- _nethack_app.hPopupWnd = NULL;
134- _nethack_app.bmpTiles = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_TILES));
135- if (_nethack_app.bmpTiles == NULL)
136- panic("cannot load tiles bitmap");
137- _nethack_app.bmpPetMark =
138- LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PETMARK));
139- if (_nethack_app.bmpPetMark == NULL)
140- panic("cannot load pet mark bitmap");
141-#ifdef USE_PILEMARK
142- _nethack_app.bmpPileMark =
143- LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_PILEMARK));
144- if (_nethack_app.bmpPileMark == NULL)
145- panic("cannot load pile mark bitmap");
146-#endif
147- _nethack_app.bmpRip = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_RIP));
148- if (_nethack_app.bmpRip == NULL)
149- panic("cannot load rip bitmap");
150- _nethack_app.bmpSplash =
151- LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_SPLASH));
152- if (_nethack_app.bmpSplash == NULL)
153- panic("cannot load splash bitmap");
154- _nethack_app.bmpMapTiles = _nethack_app.bmpTiles;
155- _nethack_app.mapTile_X = TILE_X;
156- _nethack_app.mapTile_Y = TILE_Y;
157- _nethack_app.mapTilesPerLine = TILES_PER_LINE;
158-
159- _nethack_app.bNoHScroll = FALSE;
160- _nethack_app.bNoVScroll = FALSE;
161- _nethack_app.saved_text = strdup("");
162-
163- _nethack_app.bAutoLayout = TRUE;
164- _nethack_app.bWindowsLocked = TRUE;
165-
166- _nethack_app.bNoSounds = FALSE;
167-
168-#if 0 /* GdiTransparentBlt does not render spash bitmap for whatever reason */
169- /* use system-provided TransparentBlt for Win2k+ */
170- ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
171- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
172- GetVersionEx(&osvi);
173- if (osvi.dwMajorVersion >= 5)
174- _nethack_app.lpfnTransparentBlt = GdiTransparentBlt;
175- else
176-#endif
177- _nethack_app.lpfnTransparentBlt = _nhapply_image_transparent;
178-
179- // init controls
180- if (FAILED(GetComCtlVersion(&major, &minor))) {
181- char buf[TBUFSZ];
182- Sprintf(buf, "Cannot load common control library.\n%s\n%s",
183- "For further information, refer to the installation notes at",
184- INSTALL_NOTES);
185- panic(buf);
186- }
187- if (major < MIN_COMCTLMAJOR
188- || (major == MIN_COMCTLMAJOR && minor < MIN_COMCTLMINOR)) {
189- char buf[TBUFSZ];
190- Sprintf(buf, "Common control library is outdated.\n%s %d.%d\n%s\n%s",
191- "NetHack requires at least version ", MIN_COMCTLMAJOR,
192- MIN_COMCTLMINOR,
193- "For further information, refer to the installation notes at",
194- INSTALL_NOTES);
195- panic(buf);
196- }
197- ZeroMemory(&InitCtrls, sizeof(InitCtrls));
198- InitCtrls.dwSize = sizeof(InitCtrls);
199- InitCtrls.dwICC = ICC_LISTVIEW_CLASSES;
200- InitCommonControlsEx(&InitCtrls);
201-
202- /* get command line parameters */
203- p = _get_cmd_arg(GetCommandLine());
204- p = _get_cmd_arg(NULL); /* skip first paramter - command name */
205- for (argc = 1; p && argc < MAX_CMDLINE_PARAM; argc++) {
206- len = _tcslen(p);
207- if (len > 0) {
208- argv[argc] = _strdup(NH_W2A(p, buf, BUFSZ));
209- } else {
210- argv[argc] = "";
211- }
212- p = _get_cmd_arg(NULL);
213- }
214- GetModuleFileName(NULL, wbuf, BUFSZ);
215- argv[0] = _strdup(NH_W2A(wbuf, buf, BUFSZ));
216-
217- if (argc == 2) {
218- TCHAR *savefile = strdup(argv[1]);
219- TCHAR *plname;
220- for (p = savefile; *p && *p != '-'; p++)
221- ;
222- if (*p) {
223- /* we found a '-' */
224- plname = p + 1;
225- for (p = plname; *p && *p != '.'; p++)
226- ;
227- if (*p) {
228- if (strcmp(p + 1, "NetHack-saved-game") == 0) {
229- *p = '\0';
230- argv[1] = "-u";
231- argv[2] = _strdup(plname);
232- argc = 3;
233- }
234- }
235- }
236- free(savefile);
237- }
238- GUILaunched = 1;
239- /* let main do the argument processing */
240- (void) main(argc, argv);
241- return 0;
242-}
243-
244-PNHWinApp
245-GetNHApp()
246-{
247- return &_nethack_app;
248-}
249-
250-TCHAR *
251-_get_cmd_arg(TCHAR *pCmdLine)
252-{
253- static TCHAR *pArgs = NULL;
254- TCHAR *pRetArg;
255- BOOL bQuoted;
256-
257- if (!pCmdLine && !pArgs)
258- return NULL;
259- if (!pArgs)
260- pArgs = pCmdLine;
261-
262- /* skip whitespace */
263- for (pRetArg = pArgs; *pRetArg && _istspace(*pRetArg);
264- pRetArg = CharNext(pRetArg))
265- ;
266- if (!*pRetArg) {
267- pArgs = NULL;
268- return NULL;
269- }
270-
271- /* check for quote */
272- if (*pRetArg == TEXT('"')) {
273- bQuoted = TRUE;
274- pRetArg = CharNext(pRetArg);
275- pArgs = _tcschr(pRetArg, TEXT('"'));
276- } else {
277- /* skip to whitespace */
278- for (pArgs = pRetArg; *pArgs && !_istspace(*pArgs);
279- pArgs = CharNext(pArgs))
280- ;
281- }
282-
283- if (pArgs && *pArgs) {
284- TCHAR *p;
285- p = pArgs;
286- pArgs = CharNext(pArgs);
287- *p = (TCHAR) 0;
288- } else {
289- pArgs = NULL;
290- }
291-
292- return pRetArg;
293-}
294-
295-/* Get the version of the Common Control library on this machine.
296- Copied from the Microsoft SDK
297- */
298-HRESULT
299-GetComCtlVersion(LPDWORD pdwMajor, LPDWORD pdwMinor)
300-{
301- HINSTANCE hComCtl;
302- HRESULT hr = S_OK;
303- DLLGETVERSIONPROC pDllGetVersion;
304-
305- if (IsBadWritePtr(pdwMajor, sizeof(DWORD))
306- || IsBadWritePtr(pdwMinor, sizeof(DWORD)))
307- return E_INVALIDARG;
308- // load the DLL
309- hComCtl = LoadLibrary(TEXT("comctl32.dll"));
310- if (!hComCtl)
311- return E_FAIL;
312-
313- /*
314- You must get this function explicitly because earlier versions of the DLL
315- don't implement this function. That makes the lack of implementation of
316- the
317- function a version marker in itself.
318- */
319- pDllGetVersion =
320- (DLLGETVERSIONPROC) GetProcAddress(hComCtl, TEXT("DllGetVersion"));
321- if (pDllGetVersion) {
322- DLLVERSIONINFO dvi;
323- ZeroMemory(&dvi, sizeof(dvi));
324- dvi.cbSize = sizeof(dvi);
325- hr = (*pDllGetVersion)(&dvi);
326- if (SUCCEEDED(hr)) {
327- *pdwMajor = dvi.dwMajorVersion;
328- *pdwMinor = dvi.dwMinorVersion;
329- } else {
330- hr = E_FAIL;
331- }
332- } else {
333- /*
334- If GetProcAddress failed, then the DLL is a version previous to the
335- one
336- shipped with IE 3.x.
337- */
338- *pdwMajor = 4;
339- *pdwMinor = 0;
340- }
341- FreeLibrary(hComCtl);
342- return hr;
343-}
344-
345-/* apply bitmap pointed by sourceDc transparently over
346-bitmap pointed by hDC */
347-BOOL WINAPI
348-_nhapply_image_transparent(HDC hDC, int x, int y, int width, int height,
349- HDC sourceDC, int s_x, int s_y, int s_width,
350- int s_height, UINT cTransparent)
351-{
352- /* Don't use TransparentBlt; According to Microsoft, it contains a memory
353- * leak in Window 95/98. */
354- HDC hdcMem, hdcBack, hdcObject, hdcSave;
355- COLORREF cColor;
356- HBITMAP bmAndBack, bmAndObject, bmAndMem, bmSave;
357- HBITMAP bmBackOld, bmObjectOld, bmMemOld, bmSaveOld;
358-
359- /* Create some DCs to hold temporary data. */
360- hdcBack = CreateCompatibleDC(hDC);
361- hdcObject = CreateCompatibleDC(hDC);
362- hdcMem = CreateCompatibleDC(hDC);
363- hdcSave = CreateCompatibleDC(hDC);
364-
365- /* this is bitmap for our pet image */
366- bmSave = CreateCompatibleBitmap(hDC, width, height);
367-
368- /* Monochrome DC */
369- bmAndBack = CreateBitmap(width, height, 1, 1, NULL);
370- bmAndObject = CreateBitmap(width, height, 1, 1, NULL);
371-
372- /* resulting bitmap */
373- bmAndMem = CreateCompatibleBitmap(hDC, width, height);
374-
375- /* Each DC must select a bitmap object to store pixel data. */
376- bmBackOld = SelectObject(hdcBack, bmAndBack);
377- bmObjectOld = SelectObject(hdcObject, bmAndObject);
378- bmMemOld = SelectObject(hdcMem, bmAndMem);
379- bmSaveOld = SelectObject(hdcSave, bmSave);
380-
381- /* copy source image because it is going to be overwritten */
382- StretchBlt(hdcSave, 0, 0, width, height, sourceDC, s_x, s_y, s_width,
383- s_height, SRCCOPY);
384-
385- /* Set the background color of the source DC to the color.
386- contained in the parts of the bitmap that should be transparent */
387- cColor = SetBkColor(hdcSave, cTransparent);
388-
389- /* Create the object mask for the bitmap by performing a BitBlt
390- from the source bitmap to a monochrome bitmap. */
391- BitBlt(hdcObject, 0, 0, width, height, hdcSave, 0, 0, SRCCOPY);
392-
393- /* Set the background color of the source DC back to the original
394- color. */
395- SetBkColor(hdcSave, cColor);
396-
397- /* Create the inverse of the object mask. */
398- BitBlt(hdcBack, 0, 0, width, height, hdcObject, 0, 0, NOTSRCCOPY);
399-
400- /* Copy background to the resulting image */
401- BitBlt(hdcMem, 0, 0, width, height, hDC, x, y, SRCCOPY);
402-
403- /* Mask out the places where the source image will be placed. */
404- BitBlt(hdcMem, 0, 0, width, height, hdcObject, 0, 0, SRCAND);
405-
406- /* Mask out the transparent colored pixels on the source image. */
407- BitBlt(hdcSave, 0, 0, width, height, hdcBack, 0, 0, SRCAND);
408-
409- /* XOR the source image with the beckground. */
410- BitBlt(hdcMem, 0, 0, width, height, hdcSave, 0, 0, SRCPAINT);
411-
412- /* blt resulting image to the screen */
413- BitBlt(hDC, x, y, width, height, hdcMem, 0, 0, SRCCOPY);
414-
415- /* cleanup */
416- DeleteObject(SelectObject(hdcBack, bmBackOld));
417- DeleteObject(SelectObject(hdcObject, bmObjectOld));
418- DeleteObject(SelectObject(hdcMem, bmMemOld));
419- DeleteObject(SelectObject(hdcSave, bmSaveOld));
420-
421- DeleteDC(hdcMem);
422- DeleteDC(hdcBack);
423- DeleteDC(hdcObject);
424- DeleteDC(hdcSave);
425-
426- return TRUE;
427-}
Show on old repository browser