patch 8.0.0029

Problem:    Code for MS-Windows is complicated because of the exceptions for
            old systems.
Solution:   Drop support for MS-Windows older than Windows XP. (Ken Takata)
This commit is contained in:
Bram Moolenaar
2016-10-12 14:20:24 +02:00
parent a7c023ec88
commit cea912af72
19 changed files with 375 additions and 1298 deletions

View File

@@ -49,10 +49,6 @@ If you want Vim to start with a maximized window, add this command to your
vimrc or gvimrc file: > vimrc or gvimrc file: >
au GUIEnter * simalt ~x au GUIEnter * simalt ~x
< <
*gui-w32s*
There is a specific version of gvim.exe that runs under the Win32s subsystem
of Windows 3.1 or 3.11. See |win32s|.
Using Vim as a plugin *gui-w32-windowid* Using Vim as a plugin *gui-w32-windowid*
@@ -100,9 +96,10 @@ when you have got a new version):
You can also install Vim in the "Send To" menu: You can also install Vim in the "Send To" menu:
1. Start a Windows Explorer 1. Start a Windows Explorer
2. Navigate to your sendto directory: 2. Navigate to your sendto directory:
Windows 95: %windir%\sendto (e.g. "c:\windows\sendto")
Windows NT: %windir%\profiles\%user%\sendto (e.g. Windows NT: %windir%\profiles\%user%\sendto (e.g.
"c:\winnt\profiles\mattha\sendto"). "c:\winnt\profiles\mattha\sendto")
Windows XP: C:\Documents and Settings\%user%\SendTo
Windows Vista: C:\Users\%user%\AppData\Roaming\Microsoft\Windows\SendTo .
3. Right-click in the file pane and select New->Shortcut 3. Right-click in the file pane and select New->Shortcut
4. Follow the shortcut wizard, using the full path to VIM/GVIM. 4. Follow the shortcut wizard, using the full path to VIM/GVIM.
@@ -274,35 +271,17 @@ WARNING: If you close this window with the "X" button, and confirm the
question if you really want to kill the application, Vim may be killed too! question if you really want to kill the application, Vim may be killed too!
(This does not apply to commands run asynchronously with ":!start".) (This does not apply to commands run asynchronously with ":!start".)
In Windows 95, the window in which the commands are executed is always 25x80 The window in which the commands are executed will be the default you have set
characters, to be as DOS compatible as possible (this matters!). The default up for "Console" in Control Panel.
system font is used. On NT, the window will be the default you have set up for
"Console" in Control Panel. On Win32s, the properties of the DOS box are
determined by _default.pif in the windows directory.
*msdos-mode*
If you get a dialog that says "This program is set to run in MS-DOS mode..."
when you run an external program, you can solve this by changing the
properties of the associated shortcut:
- Use a Windows Explorer to find the command.com that is used. It can be
c:\command.com, c:\dos\command.com, c:\windows\command.com, etc.
- With the right mouse button, select properties of this command.com.
- In the Program tab select "Advanced".
- Unselect "MS-DOS mode".
- Click "OK" twice.
*win32-!start* *win32-!start*
Normally, Vim waits for a command to complete before continuing (this makes Normally, Vim waits for a command to complete before continuing (this makes
sense for most shell commands which produce output for Vim to use). If you sense for most shell commands which produce output for Vim to use). If you
want Vim to start a program and return immediately, you can use the following want Vim to start a program and return immediately, you can use the following
syntax on W95 & NT: > syntax: >
:!start [/min] {command} :!start [/min] {command}
The optional "/min" causes the window to be minimized. The optional "/min" causes the window to be minimized.
On Win32s, you will have to go to another window instead. Don't forget that
you must tell Windows 3.1x to keep executing a DOS command in the background
while you switch back to Vim.
============================================================================== ==============================================================================
5. Special colors *win32-colors* 5. Special colors *win32-colors*
@@ -311,7 +290,7 @@ On Win32, the normal DOS colors can be used. See |dos-colors|.
Additionally the system configured colors can also be used. These are known Additionally the system configured colors can also be used. These are known
by the names Sys_XXX, where XXX is the appropriate system color name, from the by the names Sys_XXX, where XXX is the appropriate system color name, from the
following list (see the Win32 documentation for full descriptions). Case is following list (see the Win32 documentation for full descriptions). Case is
ignored. Note: On Win32s not all of these colors are supported. ignored.
Sys_3DDKShadow Sys_3DFace Sys_BTNFace Sys_3DDKShadow Sys_3DFace Sys_BTNFace
Sys_3DHilight Sys_3DHighlight Sys_BTNHilight Sys_3DHilight Sys_3DHighlight Sys_BTNHilight

View File

@@ -1,4 +1,4 @@
*os_win32.txt* For Vim version 8.0. Last change: 2016 Aug 28 *os_win32.txt* For Vim version 8.0. Last change: 2016 Oct 12
VIM REFERENCE MANUAL by George Reilly VIM REFERENCE MANUAL by George Reilly
@@ -7,20 +7,18 @@
*win32* *Win32* *MS-Windows* *win32* *Win32* *MS-Windows*
This file documents the idiosyncrasies of the Win32 version of Vim. This file documents the idiosyncrasies of the Win32 version of Vim.
The Win32 version of Vim works on Windows NT, 95, 98, ME, XP, Vista and The Win32 version of Vim works on Windows XP, Vista, 7, 8 and 10. There are
Windows 7. There are both console and GUI versions. both console and GUI versions.
The 32 bit version also runs on 64 bit MS-Windows systems. The 32 bit version also runs on 64 bit MS-Windows systems.
There is GUI version for use in the Win32s subsystem in Windows 3.1[1]. You
can also use the 32-bit DOS version of Vim instead. See |os_msdos.txt|.
1. Known problems |win32-problems| 1. Known problems |win32-problems|
2. Startup |win32-startup| 2. Startup |win32-startup|
3. Restore screen contents |win32-restore| 3. Restore screen contents |win32-restore|
4. Using the mouse |win32-mouse| 4. Using the mouse |win32-mouse|
5. Running under Windows 3.1 |win32-win3.1| 5. Running under Windows 95 |win32-win95|
6. Win32 mini FAQ |win32-faq| 6. Running under Windows 3.1 |win32-win3.1|
7. Win32 mini FAQ |win32-faq|
Additionally, there are a number of common Win32 and DOS items: Additionally, there are a number of common Win32 and DOS items:
File locations |dos-locations| File locations |dos-locations|
@@ -43,20 +41,7 @@ The GUI version was made by George V. Reilly and Robert Webb.
For compiling see "src/INSTALLpc.txt". *win32-compiling* For compiling see "src/INSTALLpc.txt". *win32-compiling*
============================================================================== ==============================================================================
1. Known problems *windows95* *win32-problems* 1. Known problems *win32-problems*
There are a few known problems with running in a console on Windows 95. As
far as we know, this is the same in Windows 98 and Windows ME.
Comments from somebody working at Microsoft: "Win95 console support has always
been and will always be flaky".
1. Dead key support doesn't work.
2. Resizing the window with ":set columns=nn lines=nn" works, but executing
external commands MAY CAUSE THE SYSTEM TO HANG OR CRASH.
3. Screen updating is slow, unless you change 'columns' or 'lines' to a
non-DOS value. But then the second problem applies!
If this bothers you, use the 32 bit MS-DOS version or the Win32 GUI version.
When doing file name completion, Vim also finds matches for the short file When doing file name completion, Vim also finds matches for the short file
name. But Vim will still find and use the corresponding long file name. For name. But Vim will still find and use the corresponding long file name. For
@@ -141,60 +126,20 @@ When the mouse doesn't work, try disabling the "Quick Edit Mode" feature of
the console. the console.
============================================================================== ==============================================================================
5. Running under Windows 3.1 *win32-win3.1* 5. Running under Windows 95 *win32-win95*
*windows95* *windows98* *windowsme*
Windows 95/98/ME support was removed in patch 8.0.0029 If you want to use it
you will need to get a version older than that.
*win32s* *windows-3.1* ==============================================================================
6. Running under Windows 3.1 *win32-win3.1*
*win32s* *windows-3.1* *gui-w32s*
There was a special version of Gvim that runs under Windows 3.1 and 3.11. There was a special version of Gvim that runs under Windows 3.1 and 3.11.
Support was removed in patch 7.4.1363. Support was removed in patch 7.4.1363.
============================================================================== ==============================================================================
6. Win32 mini FAQ *win32-faq* 7. Win32 mini FAQ *win32-faq*
Q. Why does the Win32 version of Vim update the screen so slowly on Windows 95?
A. The support for Win32 console mode applications is very buggy in Win95.
For some unknown reason, the screen updates very slowly when Vim is run at
one of the standard resolutions (80x25, 80x43, or 80x50) and the 16-bit DOS
version updates the screen much more quickly than the Win32 version.
However, if the screen is set to some other resolution, such as by ":set
columns=100" or ":set lines=40", screen updating becomes about as fast as
it is with the 16-bit version.
WARNING: Changing 'columns' may make Windows 95 crash while updating the
window (complaints --> Microsoft). Since this mostly works, this has not
been disabled, but be careful with changing 'columns'.
Changing the screen resolution makes updates faster, but it brings
additional problems. External commands (e.g., ":!dir") can cause Vim to
freeze when the screen is set to a non-standard resolution, particularly
when 'columns' is not equal to 80. It is not possible for Vim to reliably
set the screen resolution back to the value it had upon startup before
running external commands, so if you change the number of 'lines' or
'columns', be very, very careful. In fact, Vim will not allow you to
execute external commands when 'columns' is not equal to 80, because it is
so likely to freeze up afterwards.
None of the above applies on Windows NT. Screen updates are fast, no
matter how many 'lines' or 'columns' the window has, and external commands
do not cause Vim to freeze.
Q. So if the Win32 version updates the screen so slowly on Windows 95 and the
16-bit DOS version updates the screen quickly, why would I want to run the
Win32 version?
A. Firstly, the Win32 version isn't that slow, especially when the screen is
set to some non-standard number of 'lines' or 'columns'. Secondly, the
16-bit DOS version has some severe limitations: It can't do big changes and
it doesn't know about long file names. The Win32 version doesn't have these
limitations and it's faster overall (the same is true for the 32-bit DJGPP
DOS version of Vim). The Win32 version is smarter about handling the
screen, the mouse, and the keyboard than the DJGPP version is.
Q. And what about the 16-bit DOS version versus the Win32 version on NT?
A. There are no good reasons to run the 16-bit DOS version on NT. The Win32
version updates the screen just as fast as the 16-bit version does when
running on NT. All of the above disadvantages apply. Finally, DOS
applications can take a long time to start up and will run more slowly. On
non-Intel NT platforms, the DOS version is almost unusably slow, because it
runs on top of an 80x86 emulator.
Q. How do I change the font? Q. How do I change the font?
A. In the GUI version, you can use the 'guifont' option. Example: > A. In the GUI version, you can use the 'guifont' option. Example: >
@@ -202,47 +147,6 @@ A. In the GUI version, you can use the 'guifont' option. Example: >
< In the console version, you need to set the font of the console itself. < In the console version, you need to set the font of the console itself.
You cannot do this from within Vim. You cannot do this from within Vim.
Q. When I change the size of the console window with ':set lines=xx' or
similar, the font changes! (Win95)
A. You have the console font set to 'Auto' in Vim's (or your MS-DOS prompt's)
properties. This makes W95 guess (badly!) what font is best. Set an explicit
font instead.
Q. Why can't I paste into Vim when running Windows 95?
A. In the properties dialog box for the MS-DOS window, go to "MS-DOS
Prompt/Misc/Fast pasting" and make sure that it is NOT checked. You should
also do ":set paste" in Vim to avoid unexpected effects. |'paste'|
Q. How do I type dead keys on Windows 95, in the console version?
(A dead key is an accent key, such as acute, grave, or umlaut, that doesn't
produce a character by itself, but when followed by another key, produces
an accented character, such as a-acute, e-grave, u-umlaut, n-tilde, and so
on. Very useful for most European languages. English-language keyboard
layouts don't use dead keys, as far as we know.)
A. You don't. The console mode input routines simply do not work correctly in
Windows 95, and I have not been able to work around them. In the words
of a senior developer at Microsoft:
Win95 console support has always been and will always be flaky.
The flakiness is unavoidable because we are stuck between the world of
MS-DOS keyboard TSRs like KEYB (which wants to cook the data;
important for international) and the world of Win32.
So keys that don't "exist" in MS-DOS land (like dead keys) have a
very tenuous existence in Win32 console land. Keys that act
differently between MS-DOS land and Win32 console land (like
capslock) will act flaky.
Don't even _mention_ the problems with multiple language keyboard
layouts...
You may be able to fashion some sort of workaround with the digraphs
mechanism. |digraphs|
The best solution is to use the Win32 GUI version gvim.exe. Alternatively,
you can try one of the DOS versions of Vim where dead keys reportedly do
work.
Q. How do I type dead keys on Windows NT? Q. How do I type dead keys on Windows NT?
A. Dead keys work on NT 3.51. Just type them as you would in any other A. Dead keys work on NT 3.51. Just type them as you would in any other
application. application.
@@ -349,28 +253,6 @@ A. You have two possible solutions depending on what you want:
< The first command runs notepad minimized and the second one runs it < The first command runs notepad minimized and the second one runs it
normally. normally.
Q. I'm using Win32s, and when I try to run an external command like "make",
Vim doesn't wait for it to finish! Help!
A. The problem is that a 32-bit application (Vim) can't get notification from
Windows that a 16-bit application (your DOS session) has finished. Vim
includes a work-around for this, but you must set up your DOS commands to
run in a window, not full-screen. Unfortunately the default when you
install Windows is full-screen. To change this:
1) Start PIF editor (in the Main program group).
2) Open the file "_DEFAULT.PIF" in your Windows directory.
3) Changes the display option from "Full Screen" to "Windowed".
4) Save and exit.
To test, start Vim and type >
:!dir C:\<CR>".
< You should see a DOS box window appear briefly with the directory listing.
Q. I use Vim under Win32s and NT. In NT, I can define the console to default to
50 lines, so that I get a 80x50 shell when I ':sh'. Can I do the same in
W3.1x, or am I stuck with 80x25?
A. Edit SYSTEM.INI and add 'ScreenLines=50' to the [NonWindowsApp] section. DOS
prompts and external DOS commands will now run in a 50-line window.
*windows-icon* *windows-icon*
Q. I don't like the Vim icon, can I change it? Q. I don't like the Vim icon, can I change it?
A. Yes, place your favorite icon in bitmaps/vim.ico in a directory of A. Yes, place your favorite icon in bitmaps/vim.ico in a directory of

View File

@@ -1,4 +1,4 @@
*todo.txt* For Vim version 8.0. Last change: 2016 Oct 09 *todo.txt* For Vim version 8.0. Last change: 2016 Oct 12
VIM REFERENCE MANUAL by Bram Moolenaar VIM REFERENCE MANUAL by Bram Moolenaar
@@ -34,10 +34,6 @@ not be repeated below, unless there is extra information.
*known-bugs* *known-bugs*
-------------------- Known bugs and current work ----------------------- -------------------- Known bugs and current work -----------------------
After 8.0 is released:
- Drop support for older MS-Windows systems, before XP.
Patch from Ken Takata, updated 2016 Sep 12.
+channel: +channel:
- Problem with stderr on Windows? (Vincent Rischmann, 2016 Aug 31, #1026) - Problem with stderr on Windows? (Vincent Rischmann, 2016 Aug 31, #1026)
- Add 'cwd' argument to start_job(): directory to change to in the child. - Add 'cwd' argument to start_job(): directory to change to in the child.
@@ -1809,10 +1805,6 @@ popup menu over it, first draw the new popup menu, remember its position and
size and then redraw the text, skipping the characters under the popup menu. size and then redraw the text, skipping the characters under the popup menu.
This should avoid flicker. Other solution by A.Politz, 2007 Aug 22. This should avoid flicker. Other solution by A.Politz, 2007 Aug 22.
Windows 98: pasting from the clipboard with text from another application has
a trailing NUL. (Joachim Hofmann) Perhaps the length specified for CF_TEXT
isn't right?
When a register contains illegal bytes, writing viminfo in utf-8 and reading When a register contains illegal bytes, writing viminfo in utf-8 and reading
it back doesn't result in utf-8. (Devin Bayer) it back doesn't result in utf-8. (Devin Bayer)
@@ -2418,8 +2410,6 @@ GTK+ GUI known bugs:
Win32 GUI known bugs: Win32 GUI known bugs:
- Win32: tearoff menu window should have a scrollbar when it's taller than - Win32: tearoff menu window should have a scrollbar when it's taller than
the screen. the screen.
8 On Windows 98 the unicows library is needed to support functions with UCS2
file names. Can we load unicows.dll dynamically?
8 The -P argument doesn't work very well with many MDI applications. 8 The -P argument doesn't work very well with many MDI applications.
The last argument of CreateWindowEx() should be used, see MSDN docs. The last argument of CreateWindowEx() should be used, see MSDN docs.
Tutorial: http://win32assembly.online.fr/tut32.html Tutorial: http://win32assembly.online.fr/tut32.html

View File

@@ -3,7 +3,7 @@
# DEBUG=yes Build debug version (for VC7 and maybe later) # DEBUG=yes Build debug version (for VC7 and maybe later)
# #
TARGETOS=BOTH TARGETOS=WINNT
!ifndef APPVER !ifndef APPVER
APPVER=5.0 APPVER=5.0
!endif !endif

View File

@@ -1,7 +1,7 @@
# Makefile for Vim on Win32 (Windows NT/2000/XP/2003 and Windows 95/98/Me) # Makefile for Vim on Win32 (Windows XP/2003/Vista/7/8/10) and Win64,
# and Win64, using the Microsoft Visual C++ compilers. Known to work with # using the Microsoft Visual C++ compilers. Known to work with VC5, VC6 (VS98),
# VC5, VC6 (VS98), VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005), # VC7.0 (VS2002), VC7.1 (VS2003), VC8 (VS2005), VC9 (VS2008), VC10 (VS2010),
# VC9 (VS2008), VC10 (VS2010) and VC11 (VS2012) # VC11 (VS2012), VC12 (VS2013) and VC14 (VS2015)
# #
# To build using other Windows compilers, see INSTALLpc.txt # To build using other Windows compilers, see INSTALLpc.txt
# #
@@ -119,7 +119,7 @@
# yes: Write a normal mapfile. # yes: Write a normal mapfile.
# lines: Write a mapfile with line numbers (only for VC6 and later) # lines: Write a mapfile with line numbers (only for VC6 and later)
# #
# Static Code Analysis: ANALYZE=yes (works with VS2012 only) # Static Code Analysis: ANALYZE=yes (works with VS2012 or later)
# #
# You can combine any of these interfaces # You can combine any of these interfaces
# #
@@ -162,9 +162,9 @@
# you can set DEFINES on the command line, e.g., # you can set DEFINES on the command line, e.g.,
# nmake -f Make_mvc.mvc "DEFINES=-DEMACS_TAGS" # nmake -f Make_mvc.mvc "DEFINES=-DEMACS_TAGS"
# Build on both Windows NT/XP and Windows 9x # Build on Windows NT/XP
TARGETOS = BOTH TARGETOS = WINNT
# Select one of eight object code directories, depends on GUI, OLE, DEBUG and # Select one of eight object code directories, depends on GUI, OLE, DEBUG and
# interfaces. # interfaces.
@@ -436,13 +436,7 @@ CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \
#>>>>> end of choices #>>>>> end of choices
########################################################################### ###########################################################################
!ifdef OS
OS_TYPE = winnt
DEL_TREE = rmdir /s /q DEL_TREE = rmdir /s /q
!else
OS_TYPE = win95
DEL_TREE = deltree /y
!endif
INTDIR=$(OBJDIR) INTDIR=$(OBJDIR)
OUTDIR=$(OBJDIR) OUTDIR=$(OBJDIR)

View File

@@ -6017,7 +6017,7 @@ f_has(typval_T *argvars, typval_T *rettv)
#endif #endif
#if defined(WIN3264) #if defined(WIN3264)
else if (STRICMP(name, "win95") == 0) else if (STRICMP(name, "win95") == 0)
n = mch_windows95(); n = FALSE; /* Win9x is no more supported. */
#endif #endif
#ifdef FEAT_NETBEANS_INTG #ifdef FEAT_NETBEANS_INTG
else if (STRICMP(name, "netbeans_enabled") == 0) else if (STRICMP(name, "netbeans_enabled") == 0)

View File

@@ -1175,14 +1175,6 @@ do_filter(
if (*cmd == NUL) /* no filter command */ if (*cmd == NUL) /* no filter command */
return; return;
#ifdef WIN3264
/*
* Check if external commands are allowed now.
*/
if (can_end_termcap_mode(TRUE) == FALSE)
return;
#endif
cursor_save = curwin->w_cursor; cursor_save = curwin->w_cursor;
linecount = line2 - line1 + 1; linecount = line2 - line1 + 1;
curwin->w_cursor.lnum = line1; curwin->w_cursor.lnum = line1;
@@ -1459,12 +1451,6 @@ do_shell(
} }
#ifdef MSWIN #ifdef MSWIN
/*
* Check if external commands are allowed now.
*/
if (can_end_termcap_mode(TRUE) == FALSE)
return;
/* /*
* Check if ":!start" is used. * Check if ":!start" is used.
*/ */

View File

@@ -7611,14 +7611,7 @@ ex_stop(exarg_T *eap)
/* /*
* Disallow suspending for "rvim". * Disallow suspending for "rvim".
*/ */
if (!check_restricted() if (!check_restricted())
#ifdef WIN3264
/*
* Check if external commands are allowed now.
*/
&& can_end_termcap_mode(TRUE)
#endif
)
{ {
if (!eap->forceit) if (!eap->forceit)
autowrite_all(); autowrite_all();

View File

@@ -319,7 +319,7 @@ static int destroying = FALSE; /* call DestroyWindow() ourselves */
#ifdef MSWIN_FIND_REPLACE #ifdef MSWIN_FIND_REPLACE
static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */ static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */
static FINDREPLACE s_findrep_struct; static FINDREPLACE s_findrep_struct;
# if defined(FEAT_MBYTE) && defined(WIN3264) # ifdef FEAT_MBYTE
static FINDREPLACEW s_findrep_struct_w; static FINDREPLACEW s_findrep_struct_w;
# endif # endif
static HWND s_findrep_hwnd = NULL; static HWND s_findrep_hwnd = NULL;
@@ -369,7 +369,7 @@ static int allow_scrollbar = FALSE;
# define MyTranslateMessage(x) TranslateMessage(x) # define MyTranslateMessage(x) TranslateMessage(x)
#endif #endif
#if (defined(WIN3264) && defined(FEAT_MBYTE)) || defined(GLOBAL_IME) #if defined(FEAT_MBYTE) || defined(GLOBAL_IME)
/* use of WindowProc depends on wide_WindowProc */ /* use of WindowProc depends on wide_WindowProc */
# define MyWindowProc vim_WindowProc # define MyWindowProc vim_WindowProc
#else #else
@@ -473,10 +473,6 @@ static UINT s_wait_timer = 0; /* Timer for get char from user */
static int s_timed_out = FALSE; static int s_timed_out = FALSE;
static int dead_key = 0; /* 0: no dead key, 1: dead key pressed */ static int dead_key = 0; /* 0: no dead key, 1: dead key pressed */
#ifdef WIN3264
static OSVERSIONINFO os_version; /* like it says. Init in gui_mch_init() */
#endif
#ifdef FEAT_BEVAL #ifdef FEAT_BEVAL
/* balloon-eval WM_NOTIFY_HANDLER */ /* balloon-eval WM_NOTIFY_HANDLER */
static void Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh); static void Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh);
@@ -695,28 +691,9 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
WCHAR wstring[2]; WCHAR wstring[2];
char_u *ws = NULL; char_u *ws = NULL;
if (os_version.dwPlatformId != VER_PLATFORM_WIN32_NT)
{
/* On Windows 95/98 we apparently get the character in the active
* codepage, not in UCS-2. If conversion is needed convert it to
* UCS-2 first. */
if ((int)GetACP() == enc_codepage)
len = 0; /* no conversion required */
else
{
string[0] = ch;
len = MultiByteToWideChar(GetACP(), 0, (LPCSTR)string,
1, wstring, 2);
}
}
else
{
wstring[0] = ch; wstring[0] = ch;
len = 1; len = 1;
}
if (len > 0)
{
/* "ch" is a UTF-16 character. Convert it to a string of bytes. When /* "ch" is a UTF-16 character. Convert it to a string of bytes. When
* "enc_codepage" is non-zero use the standard Win32 function, * "enc_codepage" is non-zero use the standard Win32 function,
* otherwise use our own conversion function (e.g., for UTF-8). */ * otherwise use our own conversion function (e.g., for UTF-8). */
@@ -751,7 +728,6 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
vim_free(ws); vim_free(ws);
} }
} }
}
if (len == 0) if (len == 0)
#endif #endif
@@ -1079,7 +1055,7 @@ _OnMenu(
#endif #endif
#ifdef MSWIN_FIND_REPLACE #ifdef MSWIN_FIND_REPLACE
# if defined(FEAT_MBYTE) && defined(WIN3264) # ifdef FEAT_MBYTE
/* /*
* copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW * copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW
*/ */
@@ -1127,11 +1103,10 @@ _OnFindRepl(void)
int flags = 0; int flags = 0;
int down; int down;
# if defined(FEAT_MBYTE) && defined(WIN3264) # ifdef FEAT_MBYTE
/* If the OS is Windows NT, and 'encoding' differs from active codepage: /* If the OS is Windows NT, and 'encoding' differs from active codepage:
* convert text from wide string. */ * convert text from wide string. */
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w); findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w);
} }
@@ -1279,7 +1254,7 @@ _TextAreaWndProc(
} }
} }
#if (defined(WIN3264) && defined(FEAT_MBYTE)) \ #if defined(FEAT_MBYTE) \
|| defined(GLOBAL_IME) \ || defined(GLOBAL_IME) \
|| defined(PROTO) || defined(PROTO)
# ifdef PROTO # ifdef PROTO
@@ -1586,10 +1561,9 @@ gui_mch_get_color(char_u *name)
static SysColorTable sys_table[] = static SysColorTable sys_table[] =
{ {
#ifdef WIN3264
{"SYS_3DDKSHADOW", COLOR_3DDKSHADOW}, {"SYS_3DDKSHADOW", COLOR_3DDKSHADOW},
{"SYS_3DHILIGHT", COLOR_3DHILIGHT}, {"SYS_3DHILIGHT", COLOR_3DHILIGHT},
#ifndef __MINGW32__ #ifdef COLOR_3DHIGHLIGHT
{"SYS_3DHIGHLIGHT", COLOR_3DHIGHLIGHT}, {"SYS_3DHIGHLIGHT", COLOR_3DHIGHLIGHT},
#endif #endif
{"SYS_BTNHILIGHT", COLOR_BTNHILIGHT}, {"SYS_BTNHILIGHT", COLOR_BTNHILIGHT},
@@ -1600,7 +1574,6 @@ gui_mch_get_color(char_u *name)
{"SYS_INFOBK", COLOR_INFOBK}, {"SYS_INFOBK", COLOR_INFOBK},
{"SYS_INFOTEXT", COLOR_INFOTEXT}, {"SYS_INFOTEXT", COLOR_INFOTEXT},
{"SYS_3DFACE", COLOR_3DFACE}, {"SYS_3DFACE", COLOR_3DFACE},
#endif
{"SYS_BTNFACE", COLOR_BTNFACE}, {"SYS_BTNFACE", COLOR_BTNFACE},
{"SYS_BTNSHADOW", COLOR_BTNSHADOW}, {"SYS_BTNSHADOW", COLOR_BTNSHADOW},
{"SYS_ACTIVEBORDER", COLOR_ACTIVEBORDER}, {"SYS_ACTIVEBORDER", COLOR_ACTIVEBORDER},
@@ -2094,11 +2067,7 @@ gui_mch_wait_for_chars(int wtime)
if (s_need_activate) if (s_need_activate)
{ {
#ifdef WIN32
(void)SetForegroundWindow(s_hwnd); (void)SetForegroundWindow(s_hwnd);
#else
(void)SetActiveWindow(s_hwnd);
#endif
s_need_activate = FALSE; s_need_activate = FALSE;
} }
@@ -2421,7 +2390,6 @@ add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text)
{ {
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
WCHAR *wn = NULL; WCHAR *wn = NULL;
int n;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
@@ -2438,11 +2406,8 @@ add_tabline_popup_menu_entry(HMENU pmenu, UINT item_id, char_u *item_text)
infow.fType = MFT_STRING; infow.fType = MFT_STRING;
infow.dwTypeData = wn; infow.dwTypeData = wn;
infow.cch = (UINT)wcslen(wn); infow.cch = (UINT)wcslen(wn);
n = InsertMenuItemW(pmenu, item_id, FALSE, &infow); InsertMenuItemW(pmenu, item_id, FALSE, &infow);
vim_free(wn); vim_free(wn);
if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
/* Failed, try using non-wide function. */
wn = NULL;
} }
} }
@@ -2563,7 +2528,7 @@ gui_mch_update_tabline(void)
if (s_tabhwnd == NULL) if (s_tabhwnd == NULL)
return; return;
#if defined(FEAT_MBYTE) #ifdef FEAT_MBYTE
# ifndef CCM_SETUNICODEFORMAT # ifndef CCM_SETUNICODEFORMAT
/* For older compilers. We assume this never changes. */ /* For older compilers. We assume this never changes. */
# define CCM_SETUNICODEFORMAT 0x2005 # define CCM_SETUNICODEFORMAT 0x2005
@@ -2708,18 +2673,15 @@ set_window_title(HWND hwnd, char *title)
if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP()) if (title != NULL && enc_codepage >= 0 && enc_codepage != (int)GetACP())
{ {
WCHAR *wbuf; WCHAR *wbuf;
int n;
/* Convert the title from 'encoding' to UTF-16. */ /* Convert the title from 'encoding' to UTF-16. */
wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL); wbuf = (WCHAR *)enc_to_utf16((char_u *)title, NULL);
if (wbuf != NULL) if (wbuf != NULL)
{ {
n = SetWindowTextW(hwnd, wbuf); SetWindowTextW(hwnd, wbuf);
vim_free(wbuf); vim_free(wbuf);
if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return;
/* Retry with non-wide function (for Windows 98). */
} }
return;
} }
#endif #endif
(void)SetWindowText(hwnd, (LPCSTR)title); (void)SetWindowText(hwnd, (LPCSTR)title);
@@ -2737,11 +2699,10 @@ gui_mch_find_dialog(exarg_T *eap)
if (!IsWindow(s_findrep_hwnd)) if (!IsWindow(s_findrep_hwnd))
{ {
initialise_findrep(eap->arg); initialise_findrep(eap->arg);
# if defined(FEAT_MBYTE) && defined(WIN3264) # ifdef FEAT_MBYTE
/* If the OS is Windows NT, and 'encoding' differs from active /* If the OS is Windows NT, and 'encoding' differs from active
* codepage: convert text and use wide function. */ * codepage: convert text and use wide function. */
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
findrep_atow(&s_findrep_struct_w, &s_findrep_struct); findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
s_findrep_hwnd = FindTextW( s_findrep_hwnd = FindTextW(
@@ -2774,9 +2735,8 @@ gui_mch_replace_dialog(exarg_T *eap)
if (!IsWindow(s_findrep_hwnd)) if (!IsWindow(s_findrep_hwnd))
{ {
initialise_findrep(eap->arg); initialise_findrep(eap->arg);
# if defined(FEAT_MBYTE) && defined(WIN3264) # ifdef FEAT_MBYTE
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
findrep_atow(&s_findrep_struct_w, &s_findrep_struct); findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
s_findrep_hwnd = ReplaceTextW( s_findrep_hwnd = ReplaceTextW(
@@ -3466,11 +3426,7 @@ static LPCSTR mshape_idcs[] =
IDC_SIZEWE, /* leftright */ IDC_SIZEWE, /* leftright */
IDC_SIZEWE, /* lrsizing */ IDC_SIZEWE, /* lrsizing */
IDC_WAIT, /* busy */ IDC_WAIT, /* busy */
#ifdef WIN3264
IDC_NO, /* no */ IDC_NO, /* no */
#else
IDC_ICON, /* no */
#endif
IDC_ARROW, /* crosshair */ IDC_ARROW, /* crosshair */
IDC_ARROW, /* hand1 */ IDC_ARROW, /* hand1 */
IDC_ARROW, /* hand2 */ IDC_ARROW, /* hand2 */
@@ -3497,11 +3453,7 @@ mch_set_mouse_shape(int shape)
#ifdef SetClassLongPtr #ifdef SetClassLongPtr
SetClassLongPtr(s_textArea, GCLP_HCURSOR, (__int3264)(LONG_PTR)LoadCursor(NULL, idc)); SetClassLongPtr(s_textArea, GCLP_HCURSOR, (__int3264)(LONG_PTR)LoadCursor(NULL, idc));
#else #else
# ifdef WIN32
SetClassLong(s_textArea, GCL_HCURSOR, (long_u)LoadCursor(NULL, idc)); SetClassLong(s_textArea, GCL_HCURSOR, (long_u)LoadCursor(NULL, idc));
# else /* Win16 */
SetClassWord(s_textArea, GCW_HCURSOR, (WORD)LoadCursor(NULL, idc));
# endif
#endif #endif
if (!p_mh) if (!p_mh)
{ {
@@ -3523,7 +3475,7 @@ mch_set_mouse_shape(int shape)
* Windows NT/2000/XP the "W" functions are used. * Windows NT/2000/XP the "W" functions are used.
*/ */
# if defined(FEAT_MBYTE) && defined(WIN3264) # ifdef FEAT_MBYTE
/* /*
* Wide version of convert_filter(). * Wide version of convert_filter().
*/ */
@@ -3728,17 +3680,15 @@ gui_mch_browse(
char_u *initdir, char_u *initdir,
char_u *filter) char_u *filter)
{ {
# ifdef FEAT_MBYTE
return gui_mch_browseW(saving, title, dflt, ext, initdir, filter);
# else
OPENFILENAME fileStruct; OPENFILENAME fileStruct;
char_u fileBuf[MAXPATHL]; char_u fileBuf[MAXPATHL];
char_u *initdirp = NULL; char_u *initdirp = NULL;
char_u *filterp; char_u *filterp;
char_u *p; char_u *p;
# if defined(FEAT_MBYTE) && defined(WIN3264)
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT)
return gui_mch_browseW(saving, title, dflt, ext, initdir, filter);
# endif
if (dflt == NULL) if (dflt == NULL)
fileBuf[0] = NUL; fileBuf[0] = NUL;
else else
@@ -3748,12 +3698,12 @@ gui_mch_browse(
filterp = convert_filter(filter); filterp = convert_filter(filter);
vim_memset(&fileStruct, 0, sizeof(OPENFILENAME)); vim_memset(&fileStruct, 0, sizeof(OPENFILENAME));
#ifdef OPENFILENAME_SIZE_VERSION_400 # ifdef OPENFILENAME_SIZE_VERSION_400
/* be compatible with Windows NT 4.0 */ /* be compatible with Windows NT 4.0 */
fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400; fileStruct.lStructSize = OPENFILENAME_SIZE_VERSION_400;
#else # else
fileStruct.lStructSize = sizeof(fileStruct); fileStruct.lStructSize = sizeof(fileStruct);
#endif # endif
fileStruct.lpstrTitle = (LPSTR)title; fileStruct.lpstrTitle = (LPSTR)title;
fileStruct.lpstrDefExt = (LPSTR)ext; fileStruct.lpstrDefExt = (LPSTR)ext;
@@ -3783,10 +3733,10 @@ gui_mch_browse(
* Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog. * Don't use OFN_OVERWRITEPROMPT, Vim has its own ":confirm" dialog.
*/ */
fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY); fileStruct.Flags = (OFN_NOCHANGEDIR | OFN_PATHMUSTEXIST | OFN_HIDEREADONLY);
#ifdef FEAT_SHORTCUT # ifdef FEAT_SHORTCUT
if (curbuf->b_p_bin) if (curbuf->b_p_bin)
fileStruct.Flags |= OFN_NODEREFERENCELINKS; fileStruct.Flags |= OFN_NODEREFERENCELINKS;
#endif # endif
if (saving) if (saving)
{ {
if (!GetSaveFileName(&fileStruct)) if (!GetSaveFileName(&fileStruct))
@@ -3806,6 +3756,7 @@ gui_mch_browse(
/* Shorten the file name if possible */ /* Shorten the file name if possible */
return vim_strsave(shorten_fname1((char_u *)fileBuf)); return vim_strsave(shorten_fname1((char_u *)fileBuf));
# endif
} }
#endif /* FEAT_BROWSE */ #endif /* FEAT_BROWSE */
@@ -3816,16 +3767,11 @@ _OnDropFiles(
HDROP hDrop) HDROP hDrop)
{ {
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
#ifdef WIN3264
# define BUFPATHLEN _MAX_PATH # define BUFPATHLEN _MAX_PATH
# define DRAGQVAL 0xFFFFFFFF # define DRAGQVAL 0xFFFFFFFF
#else # ifdef FEAT_MBYTE
# define BUFPATHLEN MAXPATHL
# define DRAGQVAL 0xFFFF
#endif
#ifdef FEAT_MBYTE
WCHAR wszFile[BUFPATHLEN]; WCHAR wszFile[BUFPATHLEN];
#endif # endif
char szFile[BUFPATHLEN]; char szFile[BUFPATHLEN];
UINT cFiles = DragQueryFile(hDrop, DRAGQVAL, NULL, 0); UINT cFiles = DragQueryFile(hDrop, DRAGQVAL, NULL, 0);
UINT i; UINT i;
@@ -3846,11 +3792,11 @@ _OnDropFiles(
if (fnames != NULL) if (fnames != NULL)
for (i = 0; i < cFiles; ++i) for (i = 0; i < cFiles; ++i)
{ {
#ifdef FEAT_MBYTE # ifdef FEAT_MBYTE
if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0) if (DragQueryFileW(hDrop, i, wszFile, BUFPATHLEN) > 0)
fnames[i] = utf16_to_enc(wszFile, NULL); fnames[i] = utf16_to_enc(wszFile, NULL);
else else
#endif # endif
{ {
DragQueryFile(hDrop, i, szFile, BUFPATHLEN); DragQueryFile(hDrop, i, szFile, BUFPATHLEN);
fnames[i] = vim_strsave((char_u *)szFile); fnames[i] = vim_strsave((char_u *)szFile);
@@ -3888,14 +3834,10 @@ _OnScroll(
long val; long val;
int dragging = FALSE; int dragging = FALSE;
int dont_scroll_save = dont_scroll; int dont_scroll_save = dont_scroll;
#ifndef WIN3264
int nPos;
#else
SCROLLINFO si; SCROLLINFO si;
si.cbSize = sizeof(si); si.cbSize = sizeof(si);
si.fMask = SIF_POS; si.fMask = SIF_POS;
#endif
sb = gui_mswin_find_scrollbar(hwndCtl); sb = gui_mswin_find_scrollbar(hwndCtl);
if (sb == NULL) if (sb == NULL)
@@ -3960,13 +3902,8 @@ _OnScroll(
} }
prev_code = code; prev_code = code;
#ifdef WIN3264
si.nPos = (sb->scroll_shift > 0) ? val >> sb->scroll_shift : val; si.nPos = (sb->scroll_shift > 0) ? val >> sb->scroll_shift : val;
SetScrollInfo(hwndCtl, SB_CTL, &si, TRUE); SetScrollInfo(hwndCtl, SB_CTL, &si, TRUE);
#else
nPos = (sb->scroll_shift > 0) ? val >> sb->scroll_shift : val;
SetScrollPos(hwndCtl, SB_CTL, nPos, TRUE);
#endif
/* /*
* When moving a vertical scrollbar, move the other vertical scrollbar too. * When moving a vertical scrollbar, move the other vertical scrollbar too.
@@ -3976,11 +3913,7 @@ _OnScroll(
scrollbar_T *sba = sb->wp->w_scrollbars; scrollbar_T *sba = sb->wp->w_scrollbars;
HWND id = sba[ (sb == sba + SBAR_LEFT) ? SBAR_RIGHT : SBAR_LEFT].id; HWND id = sba[ (sb == sba + SBAR_LEFT) ? SBAR_RIGHT : SBAR_LEFT].id;
#ifdef WIN3264
SetScrollInfo(id, SB_CTL, &si, TRUE); SetScrollInfo(id, SB_CTL, &si, TRUE);
#else
SetScrollPos(id, SB_CTL, nPos, TRUE);
#endif
} }
/* Don't let us be interrupted here by another message. */ /* Don't let us be interrupted here by another message. */
@@ -4448,7 +4381,6 @@ static int dialog_default_button = -1;
/* Intellimouse support */ /* Intellimouse support */
static int mouse_scroll_lines = 0; static int mouse_scroll_lines = 0;
static UINT msh_msgmousewheel = 0;
static int s_usenewlook; /* emulate W95/NT4 non-bold dialogs */ static int s_usenewlook; /* emulate W95/NT4 non-bold dialogs */
#ifdef FEAT_TOOLBAR #ifdef FEAT_TOOLBAR
@@ -4505,34 +4437,6 @@ static void dyn_imm_load(void);
# define pImmSetConversionStatus ImmSetConversionStatus # define pImmSetConversionStatus ImmSetConversionStatus
#endif #endif
/* multi monitor support */
typedef struct _MONITORINFOstruct
{
DWORD cbSize;
RECT rcMonitor;
RECT rcWork;
DWORD dwFlags;
} _MONITORINFO;
typedef HANDLE _HMONITOR;
typedef _HMONITOR (WINAPI *TMonitorFromWindow)(HWND, DWORD);
typedef BOOL (WINAPI *TGetMonitorInfo)(_HMONITOR, _MONITORINFO *);
static TMonitorFromWindow pMonitorFromWindow = NULL;
static TGetMonitorInfo pGetMonitorInfo = NULL;
static HANDLE user32_lib = NULL;
/*
* Return TRUE when running under Windows NT 3.x or Win32s, both of which have
* less fancy GUI APIs.
*/
static int
is_winnt_3(void)
{
return ((os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
&& os_version.dwMajorVersion == 3)
|| (os_version.dwPlatformId == VER_PLATFORM_WIN32s));
}
#ifdef FEAT_MENU #ifdef FEAT_MENU
/* /*
* Figure out how high the menu bar is at the moment. * Figure out how high the menu bar is at the moment.
@@ -4563,30 +4467,6 @@ gui_mswin_get_menu_height(
menu_height = old_menu_height == -1 ? 0 : old_menu_height; menu_height = old_menu_height == -1 ? 0 : old_menu_height;
} }
else else
{
if (is_winnt_3()) /* for NT 3.xx */
{
if (gui.starting)
menu_height = GetSystemMetrics(SM_CYMENU);
else
{
RECT r1, r2;
int frameht = GetSystemMetrics(SM_CYFRAME);
int capht = GetSystemMetrics(SM_CYCAPTION);
/* get window rect of s_hwnd
* get client rect of s_hwnd
* get cap height
* subtract from window rect, the sum of client height,
* (if not maximized)frame thickness, and caption height.
*/
GetWindowRect(s_hwnd, &r1);
GetClientRect(s_hwnd, &r2);
menu_height = r1.bottom - r1.top - (r2.bottom - r2.top
+ 2 * frameht * (!IsZoomed(s_hwnd)) + capht);
}
}
else /* win95 and variants (NT 4.0, I guess) */
{ {
/* /*
* In case 'lines' is set in _vimrc/_gvimrc window width doesn't * In case 'lines' is set in _vimrc/_gvimrc window width doesn't
@@ -4604,7 +4484,6 @@ gui_mswin_get_menu_height(
menu_height = rc2.bottom - rc1.top + 1; menu_height = rc2.bottom - rc1.top + 1;
} }
} }
}
if (fix_window && menu_height != old_menu_height) if (fix_window && menu_height != old_menu_height)
{ {
@@ -4636,42 +4515,11 @@ init_mouse_wheel(void)
#define VMSH_MOUSEWHEEL "MSWHEEL_ROLLMSG" #define VMSH_MOUSEWHEEL "MSWHEEL_ROLLMSG"
#define VMSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG" #define VMSH_SCROLL_LINES "MSH_SCROLL_LINES_MSG"
HWND hdl_mswheel;
UINT msh_msgscrolllines;
msh_msgmousewheel = 0;
mouse_scroll_lines = 3; /* reasonable default */ mouse_scroll_lines = 3; /* reasonable default */
if ((os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
&& os_version.dwMajorVersion >= 4)
|| (os_version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS
&& ((os_version.dwMajorVersion == 4
&& os_version.dwMinorVersion >= 10)
|| os_version.dwMajorVersion >= 5)))
{
/* if NT 4.0+ (or Win98) get scroll lines directly from system */ /* if NT 4.0+ (or Win98) get scroll lines directly from system */
SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0,
&mouse_scroll_lines, 0); &mouse_scroll_lines, 0);
}
else if (os_version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS
|| (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
&& os_version.dwMajorVersion < 4))
{ /*
* If Win95 or NT 3.51,
* try to find the hidden point32 window.
*/
hdl_mswheel = FindWindow(VMOUSEZ_CLASSNAME, VMOUSEZ_TITLE);
if (hdl_mswheel)
{
msh_msgscrolllines = RegisterWindowMessage(VMSH_SCROLL_LINES);
if (msh_msgscrolllines)
{
mouse_scroll_lines = (int)SendMessage(hdl_mswheel,
msh_msgscrolllines, 0, 0);
msh_msgmousewheel = RegisterWindowMessage(VMSH_MOUSEWHEEL);
}
}
}
} }
@@ -5210,13 +5058,8 @@ _WndProc(
#endif #endif
default: default:
if (uMsg == msh_msgmousewheel && msh_msgmousewheel != 0)
{ /* handle MSH_MOUSEWHEEL messages for Intellimouse */
_OnMouseWheel(hwnd, HIWORD(wParam));
return 0L;
}
#ifdef MSWIN_FIND_REPLACE #ifdef MSWIN_FIND_REPLACE
else if (uMsg == s_findrep_msg && s_findrep_msg != 0) if (uMsg == s_findrep_msg && s_findrep_msg != 0)
{ {
_OnFindRepl(); _OnFindRepl();
} }
@@ -5376,42 +5219,6 @@ gui_mch_prepare(int *argc, char **argv)
} }
} }
#endif #endif
/* get the OS version info */
os_version.dwOSVersionInfoSize = sizeof(os_version);
GetVersionEx(&os_version); /* this call works on Win32s, Win95 and WinNT */
/* try and load the user32.dll library and get the entry points for
* multi-monitor-support. */
if ((user32_lib = vimLoadLib("User32.dll")) != NULL)
{
pMonitorFromWindow = (TMonitorFromWindow)GetProcAddress(user32_lib,
"MonitorFromWindow");
/* there are ...A and ...W version of GetMonitorInfo - looking at
* winuser.h, they have exactly the same declaration. */
pGetMonitorInfo = (TGetMonitorInfo)GetProcAddress(user32_lib,
"GetMonitorInfoA");
}
#ifdef FEAT_MBYTE
/* If the OS is Windows NT, use wide functions;
* this enables common dialogs input unicode from IME. */
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT)
{
pDispatchMessage = DispatchMessageW;
pGetMessage = GetMessageW;
pIsDialogMessage = IsDialogMessageW;
pPeekMessage = PeekMessageW;
}
else
{
pDispatchMessage = DispatchMessageA;
pGetMessage = GetMessageA;
pIsDialogMessage = IsDialogMessageA;
pPeekMessage = PeekMessageA;
}
#endif
} }
/* /*
@@ -5475,12 +5282,7 @@ gui_mch_init(void)
atom = atom =
#endif #endif
RegisterClassW(&wndclassw)) == 0) RegisterClassW(&wndclassw)) == 0)
{
if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return FAIL; return FAIL;
/* Must be Windows 98, fall back to non-wide function. */
}
else else
wide_WindowProc = TRUE; wide_WindowProc = TRUE;
} }
@@ -5710,7 +5512,7 @@ gui_mch_init(void)
s_findrep_struct.lpstrReplaceWith[0] = NUL; s_findrep_struct.lpstrReplaceWith[0] = NUL;
s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE; s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE;
s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE; s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE;
# if defined(FEAT_MBYTE) && defined(WIN3264) # ifdef FEAT_MBYTE
s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w); s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w);
s_findrep_struct_w.lpstrFindWhat = s_findrep_struct_w.lpstrFindWhat =
(LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR)); (LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR));
@@ -5753,24 +5555,20 @@ theend:
static void static void
get_work_area(RECT *spi_rect) get_work_area(RECT *spi_rect)
{ {
_HMONITOR mon; HMONITOR mon;
_MONITORINFO moninfo; MONITORINFO moninfo;
/* use these functions only if available */
if (pMonitorFromWindow != NULL && pGetMonitorInfo != NULL)
{
/* work out which monitor the window is on, and get *it's* work area */ /* work out which monitor the window is on, and get *it's* work area */
mon = pMonitorFromWindow(s_hwnd, 1 /*MONITOR_DEFAULTTOPRIMARY*/); mon = MonitorFromWindow(s_hwnd, 1 /*MONITOR_DEFAULTTOPRIMARY*/);
if (mon != NULL) if (mon != NULL)
{ {
moninfo.cbSize = sizeof(_MONITORINFO); moninfo.cbSize = sizeof(MONITORINFO);
if (pGetMonitorInfo(mon, &moninfo)) if (GetMonitorInfo(mon, &moninfo))
{ {
*spi_rect = moninfo.rcWork; *spi_rect = moninfo.rcWork;
return; return;
} }
} }
}
/* this is the old method... */ /* this is the old method... */
SystemParametersInfo(SPI_GETWORKAREA, 0, spi_rect, 0); SystemParametersInfo(SPI_GETWORKAREA, 0, spi_rect, 0);
} }
@@ -6307,29 +6105,10 @@ RevOut( HDC s_hdc,
CONST INT *padding) CONST INT *padding)
{ {
int ix; int ix;
static int special = -1;
if (special == -1)
{
/* Check windows version: special treatment is needed if it is NT 5 or
* Win98 or higher. */
if ((os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
&& os_version.dwMajorVersion >= 5)
|| (os_version.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS
&& (os_version.dwMajorVersion > 4
|| (os_version.dwMajorVersion == 4
&& os_version.dwMinorVersion > 0))))
special = 1;
else
special = 0;
}
if (special)
for (ix = 0; ix < (int)len; ++ix) for (ix = 0; ix < (int)len; ++ix)
ExtTextOut(s_hdc, col + TEXT_X(ix), row, foptions, ExtTextOut(s_hdc, col + TEXT_X(ix), row, foptions,
pcliprect, text + ix, 1, padding); pcliprect, text + ix, 1, padding);
else
ExtTextOut(s_hdc, col, row, foptions, pcliprect, text, len, padding);
} }
#endif #endif
@@ -6718,17 +6497,8 @@ gui_mch_add_menu(
if (menu_is_menubar(menu->name)) if (menu_is_menubar(menu->name))
{ {
if (is_winnt_3())
{
InsertMenu((parent == NULL) ? s_menuBar : parent->submenu_id,
(UINT)pos, MF_POPUP | MF_STRING | MF_BYPOSITION,
(long_u)menu->submenu_id, (LPCTSTR) menu->name);
}
else
{
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
WCHAR *wn = NULL; WCHAR *wn = NULL;
int n;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
@@ -6748,13 +6518,10 @@ gui_mch_add_menu(
infow.dwTypeData = wn; infow.dwTypeData = wn;
infow.cch = (UINT)wcslen(wn); infow.cch = (UINT)wcslen(wn);
infow.hSubMenu = menu->submenu_id; infow.hSubMenu = menu->submenu_id;
n = InsertMenuItemW((parent == NULL) InsertMenuItemW((parent == NULL)
? s_menuBar : parent->submenu_id, ? s_menuBar : parent->submenu_id,
(UINT)pos, TRUE, &infow); (UINT)pos, TRUE, &infow);
vim_free(wn); vim_free(wn);
if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
/* Failed, try using non-wide function. */
wn = NULL;
} }
} }
@@ -6776,7 +6543,6 @@ gui_mch_add_menu(
(UINT)pos, TRUE, &info); (UINT)pos, TRUE, &info);
} }
} }
}
/* Fix window size if menu may have wrapped */ /* Fix window size if menu may have wrapped */
if (parent == NULL) if (parent == NULL)
@@ -6890,7 +6656,6 @@ gui_mch_add_menu_item(
{ {
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
WCHAR *wn = NULL; WCHAR *wn = NULL;
int n;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
@@ -6899,14 +6664,11 @@ gui_mch_add_menu_item(
wn = enc_to_utf16(menu->name, NULL); wn = enc_to_utf16(menu->name, NULL);
if (wn != NULL) if (wn != NULL)
{ {
n = InsertMenuW(parent->submenu_id, (UINT)idx, InsertMenuW(parent->submenu_id, (UINT)idx,
(menu_is_separator(menu->name) (menu_is_separator(menu->name)
? MF_SEPARATOR : MF_STRING) | MF_BYPOSITION, ? MF_SEPARATOR : MF_STRING) | MF_BYPOSITION,
(UINT)menu->id, wn); (UINT)menu->id, wn);
vim_free(wn); vim_free(wn);
if (n == 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
/* Failed, try using non-wide function. */
wn = NULL;
} }
} }
if (wn == NULL) if (wn == NULL)
@@ -7105,11 +6867,10 @@ dialog_callback(
/* If the edit box exists, copy the string. */ /* If the edit box exists, copy the string. */
if (s_textfield != NULL) if (s_textfield != NULL)
{ {
# if defined(FEAT_MBYTE) && defined(WIN3264) # ifdef FEAT_MBYTE
/* If the OS is Windows NT, and 'encoding' differs from active /* If the OS is Windows NT, and 'encoding' differs from active
* codepage: use wide function and convert text. */ * codepage: use wide function and convert text. */
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
WCHAR *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR)); WCHAR *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR));
char_u *p; char_u *p;
@@ -7866,12 +7627,6 @@ get_dialog_font_metrics(void)
s_usenewlook = FALSE; s_usenewlook = FALSE;
/*
* For NT3.51 and Win32s, we stick with the old look
* because it matches everything else.
*/
if (!is_winnt_3())
{
#ifdef USE_SYSMENU_FONT #ifdef USE_SYSMENU_FONT
if (gui_w32_get_menu_font(&lfSysmenu) == OK) if (gui_w32_get_menu_font(&lfSysmenu) == OK)
hfontTools = CreateFontIndirect(&lfSysmenu); hfontTools = CreateFontIndirect(&lfSysmenu);
@@ -7898,7 +7653,6 @@ get_dialog_font_metrics(void)
s_dlgfntheight = (WORD)size.cy; s_dlgfntheight = (WORD)size.cy;
s_usenewlook = TRUE; s_usenewlook = TRUE;
} }
}
if (!s_usenewlook) if (!s_usenewlook)
{ {
@@ -8044,10 +7798,6 @@ gui_mch_tearoff(
dlgwidth = textWidth; dlgwidth = textWidth;
dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X; dlgwidth += 2 * TEAROFF_PADDING_X + TEAROFF_BUTTON_PAD_X;
/* W95 can't do thin dialogs, they look v. weird! */
if (mch_windows95() && dlgwidth < TEAROFF_MIN_WIDTH)
dlgwidth = TEAROFF_MIN_WIDTH;
/* start to fill in the dlgtemplate information. addressing by WORDs */ /* start to fill in the dlgtemplate information. addressing by WORDs */
if (s_usenewlook) if (s_usenewlook)
lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU |DS_SETFONT| WS_VISIBLE; lStyle = DS_MODALFRAME | WS_CAPTION| WS_SYSMENU |DS_SETFONT| WS_VISIBLE;
@@ -8299,7 +8049,7 @@ get_toolbar_bitmap(vimmenu_T *menu)
/* /*
* Check user bitmaps first, unless builtin is specified. * Check user bitmaps first, unless builtin is specified.
*/ */
if (!is_winnt_3() && !menu->icon_builtin) if (!menu->icon_builtin)
{ {
char_u fname[MAXPATHL]; char_u fname[MAXPATHL];
HANDLE hbitmap = NULL; HANDLE hbitmap = NULL;
@@ -8556,12 +8306,6 @@ gui_mch_register_sign(char_u *signfile)
signicon_t sign, *psign; signicon_t sign, *psign;
char_u *ext; char_u *ext;
if (is_winnt_3())
{
EMSG(_(e_signdata));
return NULL;
}
sign.hImage = NULL; sign.hImage = NULL;
ext = signfile + STRLEN(signfile) - 4; /* get extension */ ext = signfile + STRLEN(signfile) - 4; /* get extension */
if (ext > signfile) if (ext > signfile)

View File

@@ -839,15 +839,11 @@ cs_create_connection(int i)
HANDLE stdin_rd, stdout_rd; HANDLE stdin_rd, stdout_rd;
HANDLE stdout_wr, stdin_wr; HANDLE stdout_wr, stdin_wr;
BOOL created; BOOL created;
# ifdef __BORLANDC__ # if (defined(_MSC_VER) && (_MSC_VER >= 1300)) || defined(__MINGW32__)
# define OPEN_OH_ARGTYPE long
# else
# if (_MSC_VER >= 1300) || defined(__MINGW32__)
# define OPEN_OH_ARGTYPE intptr_t # define OPEN_OH_ARGTYPE intptr_t
# else # else
# define OPEN_OH_ARGTYPE long # define OPEN_OH_ARGTYPE long
# endif # endif
# endif
#endif #endif
#if defined(UNIX) #if defined(UNIX)
@@ -1427,9 +1423,6 @@ cs_insert_filelist(
#ifndef UNIX #ifndef UNIX
BY_HANDLE_FILE_INFORMATION bhfi; BY_HANDLE_FILE_INFORMATION bhfi;
/* On windows 9x GetFileInformationByHandle doesn't work, so skip it */
if (!mch_windows95())
{
switch (win32_fileinfo((char_u *)fname, &bhfi)) switch (win32_fileinfo((char_u *)fname, &bhfi))
{ {
case FILEINFO_ENC_FAIL: /* enc_to_utf16() failed */ case FILEINFO_ENC_FAIL: /* enc_to_utf16() failed */
@@ -1455,7 +1448,6 @@ cs_insert_filelist(
(void)EMSG(_("E626: cannot get cscope database information")); (void)EMSG(_("E626: cannot get cscope database information"));
return -1; return -1;
} }
}
#endif #endif
i = -1; /* can be set to the index of an empty item in csinfo */ i = -1; /* can be set to the index of an empty item in csinfo */
@@ -1468,9 +1460,8 @@ cs_insert_filelist(
/* compare pathnames first */ /* compare pathnames first */
&& ((fullpathcmp((char_u *)csinfo[j].fname, && ((fullpathcmp((char_u *)csinfo[j].fname,
(char_u *)fname, FALSE) & FPC_SAME) (char_u *)fname, FALSE) & FPC_SAME)
/* if not Windows 9x, test index file attributes too */ /* test index file attributes too */
|| (!mch_windows95() || (csinfo[j].nVolume == bhfi.dwVolumeSerialNumber
&& csinfo[j].nVolume == bhfi.dwVolumeSerialNumber
&& csinfo[j].nIndexHigh == bhfi.nFileIndexHigh && csinfo[j].nIndexHigh == bhfi.nFileIndexHigh
&& csinfo[j].nIndexLow == bhfi.nFileIndexLow)) && csinfo[j].nIndexLow == bhfi.nFileIndexLow))
#endif #endif

View File

@@ -9450,9 +9450,6 @@ prepare_to_exit(void)
* screen (if there are two screens). * screen (if there are two screens).
*/ */
settmode(TMODE_COOK); settmode(TMODE_COOK);
#ifdef WIN3264
if (can_end_termcap_mode(FALSE) == TRUE)
#endif
stoptermcap(); stoptermcap();
out_flush(); out_flush();
} }

View File

@@ -1420,7 +1420,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline)
length = (unsigned)STRLEN(string) + 3; /* two quotes and a trailing NUL */ length = (unsigned)STRLEN(string) + 3; /* two quotes and a trailing NUL */
for (p = string; *p != NUL; mb_ptr_adv(p)) for (p = string; *p != NUL; mb_ptr_adv(p))
{ {
# if defined(WIN32) || defined(DOS) # ifdef WIN32
if (!p_ssl) if (!p_ssl)
{ {
if (*p == '"') if (*p == '"')
@@ -1451,7 +1451,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline)
d = escaped_string; d = escaped_string;
/* add opening quote */ /* add opening quote */
# if defined(WIN32) || defined(DOS) # ifdef WIN32
if (!p_ssl) if (!p_ssl)
*d++ = '"'; *d++ = '"';
else else
@@ -1460,7 +1460,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline)
for (p = string; *p != NUL; ) for (p = string; *p != NUL; )
{ {
# if defined(WIN32) || defined(DOS) # ifdef WIN32
if (!p_ssl) if (!p_ssl)
{ {
if (*p == '"') if (*p == '"')
@@ -1503,7 +1503,7 @@ vim_strsave_shellescape(char_u *string, int do_special, int do_newline)
} }
/* add terminating quote and finish with a NUL */ /* add terminating quote and finish with a NUL */
# if defined(WIN32) || defined(DOS) # ifdef WIN32
if (!p_ssl) if (!p_ssl)
*d++ = '"'; *d++ = '"';
else else

View File

@@ -22,7 +22,7 @@
* - If it's a list of flags, add some code in do_set(), search for WW_ALL. * - If it's a list of flags, add some code in do_set(), search for WW_ALL.
* - When adding an option with expansion (P_EXPAND), but with a different * - When adding an option with expansion (P_EXPAND), but with a different
* default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP. * default for Vi and Vim (no P_VI_DEF), add some code at VIMEXP.
* - Add documentation! One line in doc/help.txt, full description in * - Add documentation! One line in doc/quickref.txt, full description in
* options.txt, and any other related places. * options.txt, and any other related places.
* - Add an entry in runtime/optwin.vim. * - Add an entry in runtime/optwin.vim.
* When making changes: * When making changes:
@@ -9943,12 +9943,6 @@ clear_termoptions(void)
* After restoring the title, because that will need the display. */ * After restoring the title, because that will need the display. */
if (gui.starting) if (gui.starting)
clear_xterm_clip(); clear_xterm_clip();
#endif
#ifdef WIN3264
/*
* Check if this is allowed now.
*/
if (can_end_termcap_mode(FALSE) == TRUE)
#endif #endif
stoptermcap(); /* stop termcap mode */ stoptermcap(); /* stop termcap mode */

View File

@@ -38,11 +38,7 @@
# if defined(FEAT_PRINTER) && !defined(FEAT_POSTSCRIPT) # if defined(FEAT_PRINTER) && !defined(FEAT_POSTSCRIPT)
# include <dlgs.h> # include <dlgs.h>
# ifdef WIN3264
# include <winspool.h> # include <winspool.h>
# else
# include <print.h>
# endif
# include <commdlg.h> # include <commdlg.h>
#endif #endif
@@ -130,10 +126,6 @@ typedef void VOID;
FILE* fdDump = NULL; FILE* fdDump = NULL;
#endif #endif
#ifdef WIN3264
extern DWORD g_PlatformId;
#endif
#ifndef FEAT_GUI_MSWIN #ifndef FEAT_GUI_MSWIN
extern char g_szOrigTitle[]; extern char g_szOrigTitle[];
#endif #endif
@@ -248,20 +240,13 @@ mch_early_init(void)
{ {
int i; int i;
#ifdef WIN3264
PlatformId(); PlatformId();
#endif
/* Init the tables for toupper() and tolower() */ /* Init the tables for toupper() and tolower() */
for (i = 0; i < 256; ++i) for (i = 0; i < 256; ++i)
toupper_tab[i] = tolower_tab[i] = i; toupper_tab[i] = tolower_tab[i] = i;
#ifdef WIN3264
CharUpperBuff((LPSTR)toupper_tab, 256); CharUpperBuff((LPSTR)toupper_tab, 256);
CharLowerBuff((LPSTR)tolower_tab, 256); CharLowerBuff((LPSTR)tolower_tab, 256);
#else
AnsiUpperBuff((LPSTR)toupper_tab, 256);
AnsiLowerBuff((LPSTR)tolower_tab, 256);
#endif
} }
@@ -299,13 +284,11 @@ mch_settitle(
{ {
/* Convert the title from 'encoding' to the active codepage. */ /* Convert the title from 'encoding' to the active codepage. */
WCHAR *wp = enc_to_utf16(title, NULL); WCHAR *wp = enc_to_utf16(title, NULL);
int n;
if (wp != NULL) if (wp != NULL)
{ {
n = SetConsoleTitleW(wp); SetConsoleTitleW(wp);
vim_free(wp); vim_free(wp);
if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return; return;
} }
} }
@@ -379,12 +362,7 @@ mch_FullName(
#endif #endif
{ {
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
# ifdef __BORLANDC__
/* Wide functions of Borland C 5.5 do not work on Windows 98. */
&& g_PlatformId == VER_PLATFORM_WIN32_NT
# endif
)
{ {
WCHAR *wname; WCHAR *wname;
WCHAR wbuf[MAX_PATH]; WCHAR wbuf[MAX_PATH];
@@ -641,12 +619,7 @@ vim_stat(const char *name, stat_T *stp)
} }
} }
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
# ifdef __BORLANDC__
/* Wide functions of Borland C 5.5 do not work on Windows 98. */
&& g_PlatformId == VER_PLATFORM_WIN32_NT
# endif
)
{ {
WCHAR *wp = enc_to_utf16(buf, NULL); WCHAR *wp = enc_to_utf16(buf, NULL);
int n; int n;
@@ -655,11 +628,7 @@ vim_stat(const char *name, stat_T *stp)
{ {
n = wstat_symlink_aware(wp, stp); n = wstat_symlink_aware(wp, stp);
vim_free(wp); vim_free(wp);
if (n >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
return n; return n;
/* Retry with non-wide function (for Windows 98). Can't use
* GetLastError() here and it's unclear what errno gets set to if
* the _wstat() fails for missing wide functions. */
} }
} }
#endif #endif
@@ -823,9 +792,7 @@ mch_chdir(char *path)
{ {
n = _wchdir(p); n = _wchdir(p);
vim_free(p); vim_free(p);
if (n == 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
return n; return n;
/* Retry with non-wide function (for Windows 98). */
} }
} }
#endif #endif
@@ -834,27 +801,6 @@ mch_chdir(char *path)
} }
/*
* Switching off termcap mode is only allowed when Columns is 80, otherwise a
* crash may result. It's always allowed on NT or when running the GUI.
*/
/*ARGSUSED*/
int
can_end_termcap_mode(
int give_msg)
{
#ifdef FEAT_GUI_MSWIN
return TRUE; /* GUI starts a new console anyway */
#else
if (g_PlatformId == VER_PLATFORM_WIN32_NT || Columns == 80)
return TRUE;
if (give_msg)
msg((char_u *)
_("'columns' is not 80, cannot execute external commands"));
return FALSE;
#endif
}
#ifdef FEAT_GUI_MSWIN #ifdef FEAT_GUI_MSWIN
/* /*
* return non-zero if a character is available * return non-zero if a character is available
@@ -887,17 +833,10 @@ mch_screenmode(
* and returns an allocated string. * and returns an allocated string.
* Return OK if it worked, FAIL if not. * Return OK if it worked, FAIL if not.
*/ */
# ifdef WIN3264
typedef LPTSTR (*MYSTRPROCSTR)(LPTSTR); typedef LPTSTR (*MYSTRPROCSTR)(LPTSTR);
typedef LPTSTR (*MYINTPROCSTR)(int); typedef LPTSTR (*MYINTPROCSTR)(int);
typedef int (*MYSTRPROCINT)(LPTSTR); typedef int (*MYSTRPROCINT)(LPTSTR);
typedef int (*MYINTPROCINT)(int); typedef int (*MYINTPROCINT)(int);
# else
typedef LPSTR (*MYSTRPROCSTR)(LPSTR);
typedef LPSTR (*MYINTPROCSTR)(int);
typedef int (*MYSTRPROCINT)(LPSTR);
typedef int (*MYINTPROCINT)(int);
# endif
/* /*
* Check if a pointer points to a valid NUL terminated string. * Check if a pointer points to a valid NUL terminated string.
@@ -1093,7 +1032,7 @@ Trace(
#endif //_DEBUG #endif //_DEBUG
#if !defined(FEAT_GUI) || defined(PROTO) #if !defined(FEAT_GUI) || defined(PROTO)
# if defined(FEAT_TITLE) && defined(WIN3264) # ifdef FEAT_TITLE
extern HWND g_hWnd; /* This is in os_win32.c. */ extern HWND g_hWnd; /* This is in os_win32.c. */
# endif # endif
@@ -1114,7 +1053,7 @@ GetConsoleHwnd(void)
if (s_hwnd != 0) if (s_hwnd != 0)
return; return;
# if defined(FEAT_TITLE) && defined(WIN3264) # ifdef FEAT_TITLE
/* Window handle may have been found by init code (Windows NT only) */ /* Window handle may have been found by init code (Windows NT only) */
if (g_hWnd != 0) if (g_hWnd != 0)
{ {
@@ -1539,7 +1478,6 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
) )
{ {
prt_dlg.Flags |= PD_RETURNDEFAULT; prt_dlg.Flags |= PD_RETURNDEFAULT;
#ifdef WIN3264
/* /*
* MSDN suggests setting the first parameter to WINSPOOL for * MSDN suggests setting the first parameter to WINSPOOL for
* NT, but NULL appears to work just as well. * NT, but NULL appears to work just as well.
@@ -1547,7 +1485,6 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
if (*p_pdev != NUL) if (*p_pdev != NUL)
prt_dlg.hDC = CreateDC(NULL, (LPCSTR)p_pdev, NULL, NULL); prt_dlg.hDC = CreateDC(NULL, (LPCSTR)p_pdev, NULL, NULL);
else else
#endif
{ {
prt_dlg.Flags |= PD_RETURNDEFAULT; prt_dlg.Flags |= PD_RETURNDEFAULT;
if (PrintDlg(&prt_dlg) == 0) if (PrintDlg(&prt_dlg) == 0)
@@ -1593,10 +1530,8 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
mem = (DEVMODE *)GlobalLock(prt_dlg.hDevMode); mem = (DEVMODE *)GlobalLock(prt_dlg.hDevMode);
if (mem != NULL) if (mem != NULL)
{ {
#ifdef WIN3264
if (mem->dmCopies != 1) if (mem->dmCopies != 1)
stored_nCopies = mem->dmCopies; stored_nCopies = mem->dmCopies;
#endif
if ((mem->dmFields & DM_DUPLEX) && (mem->dmDuplex & ~DMDUP_SIMPLEX)) if ((mem->dmFields & DM_DUPLEX) && (mem->dmDuplex & ~DMDUP_SIMPLEX))
psettings->duplex = TRUE; psettings->duplex = TRUE;
if ((mem->dmFields & DM_COLOR) && (mem->dmColor & DMCOLOR_COLOR)) if ((mem->dmFields & DM_COLOR) && (mem->dmColor & DMCOLOR_COLOR))
@@ -1953,7 +1888,7 @@ shortcut_errorw:
goto shortcut_end; goto shortcut_end;
} }
} }
/* Retry with non-wide function (for Windows 98). */ goto shortcut_end;
} }
# endif # endif
// create a link manager object and request its interface // create a link manager object and request its interface
@@ -2681,7 +2616,6 @@ charset_pairs[] =
{"OEM", OEM_CHARSET}, {"OEM", OEM_CHARSET},
{"SHIFTJIS", SHIFTJIS_CHARSET}, {"SHIFTJIS", SHIFTJIS_CHARSET},
{"SYMBOL", SYMBOL_CHARSET}, {"SYMBOL", SYMBOL_CHARSET},
#ifdef WIN3264
{"ARABIC", ARABIC_CHARSET}, {"ARABIC", ARABIC_CHARSET},
{"BALTIC", BALTIC_CHARSET}, {"BALTIC", BALTIC_CHARSET},
{"EASTEUROPE", EASTEUROPE_CHARSET}, {"EASTEUROPE", EASTEUROPE_CHARSET},
@@ -2693,10 +2627,8 @@ charset_pairs[] =
{"RUSSIAN", RUSSIAN_CHARSET}, {"RUSSIAN", RUSSIAN_CHARSET},
{"THAI", THAI_CHARSET}, {"THAI", THAI_CHARSET},
{"TURKISH", TURKISH_CHARSET}, {"TURKISH", TURKISH_CHARSET},
# if (!defined(_MSC_VER) || (_MSC_VER > 1010)) \ #ifdef VIETNAMESE_CHARSET
&& (!defined(__BORLANDC__) || (__BORLANDC__ > 0x0500))
{"VIETNAMESE", VIETNAMESE_CHARSET}, {"VIETNAMESE", VIETNAMESE_CHARSET},
# endif
#endif #endif
{NULL, 0} {NULL, 0}
}; };

View File

@@ -141,43 +141,11 @@ typedef int LPSECURITY_ATTRIBUTES;
# define __stdcall /* empty */ # define __stdcall /* empty */
#endif #endif
#ifndef FEAT_GUI_W32
/* Undocumented API in kernel32.dll needed to work around dead key bug in
* console-mode applications in NT 4.0. If you switch keyboard layouts
* in a console app to a layout that includes dead keys and then hit a
* dead key, a call to ToAscii will trash the stack. My thanks to Ian James
* and Michael Dietrich for helping me figure out this workaround.
*/
/* WINAPI BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR); */
#ifndef WINAPI
# define WINAPI __stdcall
#endif
#if defined(__BORLANDC__)
typedef BOOL (__stdcall *PFNGCKLN)(LPSTR);
#else
typedef BOOL (WINAPI *PFNGCKLN)(LPSTR);
#endif
static PFNGCKLN s_pfnGetConsoleKeyboardLayoutName = NULL;
#endif
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
/* Strangely Borland uses a non-standard name. */ /* Strangely Borland uses a non-standard name. */
# define wcsicmp(a, b) wcscmpi((a), (b)) # define wcsicmp(a, b) wcscmpi((a), (b))
#endif #endif
#ifndef PROTO
/* Enable common dialogs input unicode from IME if possible. */
#ifdef FEAT_MBYTE
LRESULT (WINAPI *pDispatchMessage)(CONST MSG *) = DispatchMessage;
BOOL (WINAPI *pGetMessage)(LPMSG, HWND, UINT, UINT) = GetMessage;
BOOL (WINAPI *pIsDialogMessage)(HWND, LPMSG) = IsDialogMessage;
BOOL (WINAPI *pPeekMessage)(LPMSG, HWND, UINT, UINT, UINT) = PeekMessage;
#endif
#endif /* PROTO */
#ifndef FEAT_GUI_W32 #ifndef FEAT_GUI_W32
/* Win32 Console handles for input and output */ /* Win32 Console handles for input and output */
static HANDLE g_hConIn = INVALID_HANDLE_VALUE; static HANDLE g_hConIn = INVALID_HANDLE_VALUE;
@@ -430,7 +398,6 @@ unescape_shellxquote(char_u *p, char_u *escaped)
vimLoadLib(char *name) vimLoadLib(char *name)
{ {
HINSTANCE dll = NULL; HINSTANCE dll = NULL;
char old_dir[MAXPATHL];
/* NOTE: Do not use mch_dirname() and mch_chdir() here, they may call /* NOTE: Do not use mch_dirname() and mch_chdir() here, they may call
* vimLoadLib() recursively, which causes a stack overflow. */ * vimLoadLib() recursively, which causes a stack overflow. */
@@ -438,7 +405,6 @@ vimLoadLib(char *name)
get_exe_name(); get_exe_name();
if (exe_path != NULL) if (exe_path != NULL)
{ {
#ifdef FEAT_MBYTE
WCHAR old_dirw[MAXPATHL]; WCHAR old_dirw[MAXPATHL];
if (GetCurrentDirectoryW(MAXPATHL, old_dirw) != 0) if (GetCurrentDirectoryW(MAXPATHL, old_dirw) != 0)
@@ -451,18 +417,6 @@ vimLoadLib(char *name)
SetCurrentDirectoryW(old_dirw); SetCurrentDirectoryW(old_dirw);
return dll; return dll;
} }
/* Retry with non-wide function (for Windows 98). */
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
#endif
if (GetCurrentDirectory(MAXPATHL, old_dir) != 0)
{
/* Change directory to where the executable is, both to make
* sure we find a .dll there and to avoid looking for a .dll
* in the current directory. */
SetCurrentDirectory((LPCSTR)exe_path);
dll = LoadLibrary(name);
SetCurrentDirectory(old_dir);
}
} }
return dll; return dll;
} }
@@ -621,38 +575,8 @@ DWORD g_PlatformId;
# ifndef PROTECTED_DACL_SECURITY_INFORMATION # ifndef PROTECTED_DACL_SECURITY_INFORMATION
# define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000L # define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000L
# endif # endif
/*
* These are needed to dynamically load the ADVAPI DLL, which is not
* implemented under Windows 95 (and causes VIM to crash)
*/
typedef DWORD (WINAPI *PSNSECINFO) (LPSTR, SE_OBJECT_TYPE,
SECURITY_INFORMATION, PSID, PSID, PACL, PACL);
typedef DWORD (WINAPI *PGNSECINFO) (LPSTR, SE_OBJECT_TYPE,
SECURITY_INFORMATION, PSID *, PSID *, PACL *, PACL *,
PSECURITY_DESCRIPTOR *);
# ifdef FEAT_MBYTE
typedef DWORD (WINAPI *PSNSECINFOW) (LPWSTR, SE_OBJECT_TYPE,
SECURITY_INFORMATION, PSID, PSID, PACL, PACL);
typedef DWORD (WINAPI *PGNSECINFOW) (LPWSTR, SE_OBJECT_TYPE,
SECURITY_INFORMATION, PSID *, PSID *, PACL *, PACL *,
PSECURITY_DESCRIPTOR *);
# endif
static HANDLE advapi_lib = NULL; /* Handle for ADVAPI library */
static PSNSECINFO pSetNamedSecurityInfo;
static PGNSECINFO pGetNamedSecurityInfo;
# ifdef FEAT_MBYTE
static PSNSECINFOW pSetNamedSecurityInfoW;
static PGNSECINFOW pGetNamedSecurityInfoW;
# endif
#endif #endif
typedef BOOL (WINAPI *PSETHANDLEINFORMATION)(HANDLE, DWORD, DWORD);
static BOOL allowPiping = FALSE;
static PSETHANDLEINFORMATION pSetHandleInformation;
#ifdef HAVE_ACL #ifdef HAVE_ACL
/* /*
* Enables or disables the specified privilege. * Enables or disables the specified privilege.
@@ -712,93 +636,13 @@ PlatformId(void)
win8_or_later = TRUE; win8_or_later = TRUE;
#ifdef HAVE_ACL #ifdef HAVE_ACL
/*
* Load the ADVAPI runtime if we are on anything
* other than Windows 95
*/
if (g_PlatformId == VER_PLATFORM_WIN32_NT)
{
/*
* do this load. Problems: Doesn't unload at end of run (this is
* theoretically okay, since Windows should unload it when VIM
* terminates). Should we be using the 'mch_libcall' routines?
* Seems like a lot of overhead to load/unload ADVAPI32.DLL each
* time we verify security...
*/
advapi_lib = vimLoadLib("ADVAPI32.DLL");
if (advapi_lib != NULL)
{
pSetNamedSecurityInfo = (PSNSECINFO)GetProcAddress(advapi_lib,
"SetNamedSecurityInfoA");
pGetNamedSecurityInfo = (PGNSECINFO)GetProcAddress(advapi_lib,
"GetNamedSecurityInfoA");
# ifdef FEAT_MBYTE
pSetNamedSecurityInfoW = (PSNSECINFOW)GetProcAddress(advapi_lib,
"SetNamedSecurityInfoW");
pGetNamedSecurityInfoW = (PGNSECINFOW)GetProcAddress(advapi_lib,
"GetNamedSecurityInfoW");
# endif
if (pSetNamedSecurityInfo == NULL
|| pGetNamedSecurityInfo == NULL
# ifdef FEAT_MBYTE
|| pSetNamedSecurityInfoW == NULL
|| pGetNamedSecurityInfoW == NULL
# endif
)
{
/* If we can't get the function addresses, set advapi_lib
* to NULL so that we don't use them. */
FreeLibrary(advapi_lib);
advapi_lib = NULL;
}
/* Enable privilege for getting or setting SACLs. */ /* Enable privilege for getting or setting SACLs. */
win32_enable_privilege(SE_SECURITY_NAME, TRUE); win32_enable_privilege(SE_SECURITY_NAME, TRUE);
}
}
#endif #endif
/*
* If we are on windows NT, try to load the pipe functions, only
* available from Win2K.
*/
if (g_PlatformId == VER_PLATFORM_WIN32_NT)
{
HANDLE kernel32 = GetModuleHandle("kernel32");
pSetHandleInformation = (PSETHANDLEINFORMATION)GetProcAddress(
kernel32, "SetHandleInformation");
allowPiping = pSetHandleInformation != NULL;
}
done = TRUE; done = TRUE;
} }
} }
/*
* Return TRUE when running on Windows 95 (or 98 or ME).
* Only to be used after mch_init().
*/
int
mch_windows95(void)
{
return g_PlatformId == VER_PLATFORM_WIN32_WINDOWS;
}
#ifdef FEAT_GUI_W32
/*
* Used to work around the "can't do synchronous spawn"
* problem on Win32s, without resorting to Universal Thunk.
*/
static int old_num_windows;
static int num_windows;
/*ARGSUSED*/
static BOOL CALLBACK
win32ssynch_cb(HWND hwnd, LPARAM lparam)
{
num_windows++;
return TRUE;
}
#endif
#ifndef FEAT_GUI_W32 #ifndef FEAT_GUI_W32
#define SHIFT (SHIFT_PRESSED) #define SHIFT (SHIFT_PRESSED)
@@ -926,15 +770,6 @@ win32_kbd_patch_key(
vim_memset(abKeystate, 0, sizeof (abKeystate)); vim_memset(abKeystate, 0, sizeof (abKeystate));
// Should only be non-NULL on NT 4.0
if (s_pfnGetConsoleKeyboardLayoutName != NULL)
{
CHAR szKLID[KL_NAMELENGTH];
if ((*s_pfnGetConsoleKeyboardLayoutName)(szKLID))
(void)LoadKeyboardLayout(szKLID, KLF_ACTIVATE);
}
/* Clear any pending dead keys */ /* Clear any pending dead keys */
ToUnicode(VK_SPACE, MapVirtualKey(VK_SPACE, 0), abKeystate, awAnsiCode, 2, 0); ToUnicode(VK_SPACE, MapVirtualKey(VK_SPACE, 0), abKeystate, awAnsiCode, 2, 0);
@@ -1977,8 +1812,6 @@ executable_exists(char *name, char_u **path)
n = (long)SearchPathW(wnewpath, p, NULL, _MAX_PATH, fnamew, &dumw); n = (long)SearchPathW(wnewpath, p, NULL, _MAX_PATH, fnamew, &dumw);
vim_free(wnewpath); vim_free(wnewpath);
vim_free(p); vim_free(p);
if (n > 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
{
if (n == 0) if (n == 0)
return FALSE; return FALSE;
if (GetFileAttributesW(fnamew) & FILE_ATTRIBUTE_DIRECTORY) if (GetFileAttributesW(fnamew) & FILE_ATTRIBUTE_DIRECTORY)
@@ -1987,8 +1820,6 @@ executable_exists(char *name, char_u **path)
*path = utf16_to_enc(fnamew, NULL); *path = utf16_to_enc(fnamew, NULL);
return TRUE; return TRUE;
} }
/* Retry with non-wide function (for Windows 98). */
}
} }
#endif #endif
@@ -2462,8 +2293,6 @@ SetConsoleIcon(
static void static void
SaveConsoleTitleAndIcon(void) SaveConsoleTitleAndIcon(void)
{ {
GETCONSOLEWINDOWPROC GetConsoleWindowProc;
/* Save the original title. */ /* Save the original title. */
if (!GetConsoleTitle(g_szOrigTitle, sizeof(g_szOrigTitle))) if (!GetConsoleTitle(g_szOrigTitle, sizeof(g_szOrigTitle)))
return; return;
@@ -2475,12 +2304,7 @@ SaveConsoleTitleAndIcon(void)
* 2000. On older operating systems, we can't change the window icon * 2000. On older operating systems, we can't change the window icon
* anyway. * anyway.
*/ */
if ((GetConsoleWindowProc = (GETCONSOLEWINDOWPROC) g_hWnd = GetConsoleWindow();
GetProcAddress(GetModuleHandle("KERNEL32.DLL"),
"GetConsoleWindow")) != NULL)
{
g_hWnd = (*GetConsoleWindowProc)();
}
if (g_hWnd == NULL) if (g_hWnd == NULL)
return; return;
@@ -2589,11 +2413,6 @@ mch_init(void)
#ifdef FEAT_CLIPBOARD #ifdef FEAT_CLIPBOARD
win_clip_init(); win_clip_init();
#endif #endif
/* This will be NULL on anything but NT 4.0 */
s_pfnGetConsoleKeyboardLayoutName =
(PFNGCKLN) GetProcAddress(GetModuleHandle("kernel32.dll"),
"GetConsoleKeyboardLayoutNameA");
} }
/* /*
@@ -2775,9 +2594,6 @@ fname_casew(
*porig = c; *porig = c;
ptrue = ptruePrev + wcslen(ptruePrev); ptrue = ptruePrev + wcslen(ptruePrev);
} }
else if (hFind == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
return FAIL;
} }
wcscpy(name, szTrueName); wcscpy(name, szTrueName);
@@ -2836,7 +2652,7 @@ fname_case(
} }
} }
} }
/* Retry with non-wide function (for Windows 98). */ return;
} }
#endif #endif
@@ -2966,9 +2782,6 @@ mch_get_user_name(
return OK; return OK;
} }
} }
else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return FAIL;
/* Retry with non-wide function (for Windows 98). */
} }
#endif #endif
if (GetUserName(szUserName, &cch)) if (GetUserName(szUserName, &cch))
@@ -3008,9 +2821,6 @@ mch_get_host_name(
return; return;
} }
} }
else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return;
/* Retry with non-wide function (for Windows 98). */
} }
#endif #endif
if (!GetComputerName((LPSTR)s, &cch)) if (!GetComputerName((LPSTR)s, &cch))
@@ -3059,9 +2869,7 @@ mch_dirname(
return OK; return OK;
} }
} }
else if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return FAIL; return FAIL;
/* Retry with non-wide function (for Windows 98). */
} }
#endif #endif
return (GetCurrentDirectory(len, (LPSTR)buf) != 0 ? OK : FAIL); return (GetCurrentDirectory(len, (LPSTR)buf) != 0 ? OK : FAIL);
@@ -3101,9 +2909,8 @@ mch_setperm(char_u *name, long perm)
{ {
n = _wchmod(p, perm); n = _wchmod(p, perm);
vim_free(p); vim_free(p);
if (n == -1 && g_PlatformId == VER_PLATFORM_WIN32_NT) if (n == -1)
return FAIL; return FAIL;
/* Retry with non-wide function (for Windows 98). */
} }
} }
if (n == -1) if (n == -1)
@@ -3251,18 +3058,7 @@ mch_is_symbolic_link(char_u *name)
{ {
hFind = FindFirstFileW(wn, &findDataW); hFind = FindFirstFileW(wn, &findDataW);
vim_free(wn); vim_free(wn);
if (hFind == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
/* Retry with non-wide function (for Windows 98). */
hFind = FindFirstFile((LPCSTR)name, &findDataA);
if (hFind != INVALID_HANDLE_VALUE) if (hFind != INVALID_HANDLE_VALUE)
{
fileFlags = findDataA.dwFileAttributes;
reparseTag = findDataA.dwReserved0;
}
}
else
{ {
fileFlags = findDataW.dwFileAttributes; fileFlags = findDataW.dwFileAttributes;
reparseTag = findDataW.dwReserved0; reparseTag = findDataW.dwReserved0;
@@ -3321,7 +3117,7 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info)
{ {
wn = enc_to_utf16(fname, NULL); wn = enc_to_utf16(fname, NULL);
if (wn == NULL) if (wn == NULL)
res = FILEINFO_ENC_FAIL; return FILEINFO_ENC_FAIL;
} }
if (wn != NULL) if (wn != NULL)
{ {
@@ -3332,15 +3128,9 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info)
OPEN_EXISTING, /* creation disposition */ OPEN_EXISTING, /* creation disposition */
FILE_FLAG_BACKUP_SEMANTICS, /* file attributes */ FILE_FLAG_BACKUP_SEMANTICS, /* file attributes */
NULL); /* handle to template file */ NULL); /* handle to template file */
if (hFile == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
/* Retry with non-wide function (for Windows 98). */
vim_free(wn); vim_free(wn);
wn = NULL;
} }
} else
if (wn == NULL)
#endif #endif
hFile = CreateFile((LPCSTR)fname, /* file name */ hFile = CreateFile((LPCSTR)fname, /* file name */
GENERIC_READ, /* access mode */ GENERIC_READ, /* access mode */
@@ -3359,9 +3149,6 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info)
CloseHandle(hFile); CloseHandle(hFile);
} }
#ifdef FEAT_MBYTE
vim_free(wn);
#endif
return res; return res;
} }
@@ -3383,19 +3170,12 @@ win32_getattrs(char_u *name)
if (p != NULL) if (p != NULL)
{ {
attr = GetFileAttributesW(p); attr = GetFileAttributesW(p);
if (attr < 0 && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
/* Retry with non-wide function (for Windows 98). */
vim_free(p); vim_free(p);
p = NULL;
} }
} else
if (p == NULL)
#endif #endif
attr = GetFileAttributes((char *)name); attr = GetFileAttributes((char *)name);
#ifdef FEAT_MBYTE
vim_free(p);
#endif
return attr; return attr;
} }
@@ -3418,20 +3198,12 @@ win32_setattrs(char_u *name, int attrs)
if (p != NULL) if (p != NULL)
{ {
res = SetFileAttributesW(p, attrs); res = SetFileAttributesW(p, attrs);
if (res == FALSE
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
/* Retry with non-wide function (for Windows 98). */
vim_free(p); vim_free(p);
p = NULL;
} }
} else
if (p == NULL)
#endif #endif
res = SetFileAttributes((char *)name, attrs); res = SetFileAttributes((char *)name, attrs);
#ifdef FEAT_MBYTE
vim_free(p);
#endif
return res ? 0 : -1; return res ? 0 : -1;
} }
@@ -3539,8 +3311,8 @@ mch_nodetype(char_u *name)
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
wn = enc_to_utf16(name, NULL); wn = enc_to_utf16(name, NULL);
if (wn != NULL) if (wn != NULL)
{ {
hFile = CreateFileW(wn, /* file name */ hFile = CreateFileW(wn, /* file name */
@@ -3550,16 +3322,9 @@ mch_nodetype(char_u *name)
OPEN_EXISTING, /* creation disposition */ OPEN_EXISTING, /* creation disposition */
0, /* file attributes */ 0, /* file attributes */
NULL); /* handle to template file */ NULL); /* handle to template file */
if (hFile == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
/* Retry with non-wide function (for Windows 98). */
vim_free(wn); vim_free(wn);
wn = NULL;
} }
} else
}
if (wn == NULL)
#endif #endif
hFile = CreateFile((LPCSTR)name, /* file name */ hFile = CreateFile((LPCSTR)name, /* file name */
GENERIC_WRITE, /* access mode */ GENERIC_WRITE, /* access mode */
@@ -3569,9 +3334,6 @@ mch_nodetype(char_u *name)
0, /* file attributes */ 0, /* file attributes */
NULL); /* handle to template file */ NULL); /* handle to template file */
#ifdef FEAT_MBYTE
vim_free(wn);
#endif
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
return NODE_NORMAL; return NODE_NORMAL;
@@ -3608,9 +3370,6 @@ mch_get_acl(char_u *fname)
struct my_acl *p = NULL; struct my_acl *p = NULL;
DWORD err; DWORD err;
/* This only works on Windows NT and 2000. */
if (g_PlatformId == VER_PLATFORM_WIN32_NT && advapi_lib != NULL)
{
p = (struct my_acl *)alloc_clear((unsigned)sizeof(struct my_acl)); p = (struct my_acl *)alloc_clear((unsigned)sizeof(struct my_acl));
if (p != NULL) if (p != NULL)
{ {
@@ -3622,7 +3381,7 @@ mch_get_acl(char_u *fname)
if (wn != NULL) if (wn != NULL)
{ {
/* Try to retrieve the entire security descriptor. */ /* Try to retrieve the entire security descriptor. */
err = pGetNamedSecurityInfoW( err = GetNamedSecurityInfoW(
wn, // Abstract filename wn, // Abstract filename
SE_FILE_OBJECT, // File Object SE_FILE_OBJECT, // File Object
OWNER_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION |
@@ -3638,7 +3397,7 @@ mch_get_acl(char_u *fname)
err == ERROR_PRIVILEGE_NOT_HELD) err == ERROR_PRIVILEGE_NOT_HELD)
{ {
/* Retrieve only DACL. */ /* Retrieve only DACL. */
(void)pGetNamedSecurityInfoW( (void)GetNamedSecurityInfoW(
wn, wn,
SE_FILE_OBJECT, SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION, DACL_SECURITY_INFORMATION,
@@ -3659,7 +3418,7 @@ mch_get_acl(char_u *fname)
# endif # endif
{ {
/* Try to retrieve the entire security descriptor. */ /* Try to retrieve the entire security descriptor. */
err = pGetNamedSecurityInfo( err = GetNamedSecurityInfo(
(LPSTR)fname, // Abstract filename (LPSTR)fname, // Abstract filename
SE_FILE_OBJECT, // File Object SE_FILE_OBJECT, // File Object
OWNER_SECURITY_INFORMATION | OWNER_SECURITY_INFORMATION |
@@ -3675,7 +3434,7 @@ mch_get_acl(char_u *fname)
err == ERROR_PRIVILEGE_NOT_HELD) err == ERROR_PRIVILEGE_NOT_HELD)
{ {
/* Retrieve only DACL. */ /* Retrieve only DACL. */
(void)pGetNamedSecurityInfo( (void)GetNamedSecurityInfo(
(LPSTR)fname, (LPSTR)fname,
SE_FILE_OBJECT, SE_FILE_OBJECT,
DACL_SECURITY_INFORMATION, DACL_SECURITY_INFORMATION,
@@ -3692,7 +3451,6 @@ mch_get_acl(char_u *fname)
} }
} }
} }
}
return (vim_acl_T)p; return (vim_acl_T)p;
#endif #endif
@@ -3733,7 +3491,7 @@ mch_set_acl(char_u *fname, vim_acl_T acl)
struct my_acl *p = (struct my_acl *)acl; struct my_acl *p = (struct my_acl *)acl;
SECURITY_INFORMATION sec_info = 0; SECURITY_INFORMATION sec_info = 0;
if (p != NULL && advapi_lib != NULL) if (p != NULL)
{ {
# ifdef FEAT_MBYTE # ifdef FEAT_MBYTE
WCHAR *wn = NULL; WCHAR *wn = NULL;
@@ -3761,7 +3519,7 @@ mch_set_acl(char_u *fname, vim_acl_T acl)
wn = enc_to_utf16(fname, NULL); wn = enc_to_utf16(fname, NULL);
if (wn != NULL) if (wn != NULL)
{ {
(void)pSetNamedSecurityInfoW( (void)SetNamedSecurityInfoW(
wn, // Abstract filename wn, // Abstract filename
SE_FILE_OBJECT, // File Object SE_FILE_OBJECT, // File Object
sec_info, sec_info,
@@ -3775,7 +3533,7 @@ mch_set_acl(char_u *fname, vim_acl_T acl)
else else
# endif # endif
{ {
(void)pSetNamedSecurityInfo( (void)SetNamedSecurityInfo(
(LPSTR)fname, // Abstract filename (LPSTR)fname, // Abstract filename
SE_FILE_OBJECT, // File Object SE_FILE_OBJECT, // File Object
sec_info, sec_info,
@@ -4076,7 +3834,7 @@ vim_create_process(
STARTUPINFO *si, STARTUPINFO *si,
PROCESS_INFORMATION *pi) PROCESS_INFORMATION *pi)
{ {
# ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL); WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL);
@@ -4138,31 +3896,21 @@ mch_system_classic(char *cmd, int options)
si.lpTitle = NULL; si.lpTitle = NULL;
si.dwFlags = STARTF_USESHOWWINDOW; si.dwFlags = STARTF_USESHOWWINDOW;
/* /*
* It's nicer to run a filter command in a minimized window, but in * It's nicer to run a filter command in a minimized window.
* Windows 95 this makes the command MUCH slower. We can't do it under
* Win32s either as it stops the synchronous spawn workaround working.
* Don't activate the window to keep focus on Vim. * Don't activate the window to keep focus on Vim.
*/ */
if ((options & SHELL_DOOUT) && !mch_windows95()) if (options & SHELL_DOOUT)
si.wShowWindow = SW_SHOWMINNOACTIVE; si.wShowWindow = SW_SHOWMINNOACTIVE;
else else
si.wShowWindow = SW_SHOWNORMAL; si.wShowWindow = SW_SHOWNORMAL;
si.cbReserved2 = 0; si.cbReserved2 = 0;
si.lpReserved2 = NULL; si.lpReserved2 = NULL;
/* There is a strange error on Windows 95 when using "c:\command.com".
* When the "c:\\" is left out it works OK...? */
if (mch_windows95()
&& (STRNICMP(cmd, "c:/command.com", 14) == 0
|| STRNICMP(cmd, "c:\\command.com", 14) == 0))
cmd += 3;
/* Now, run the command */ /* Now, run the command */
vim_create_process(cmd, FALSE, vim_create_process(cmd, FALSE,
CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE, &si, &pi); CREATE_DEFAULT_ERROR_MODE | CREATE_NEW_CONSOLE, &si, &pi);
/* Wait for the command to terminate before continuing */ /* Wait for the command to terminate before continuing */
if (g_PlatformId != VER_PLATFORM_WIN32s)
{ {
#ifdef FEAT_GUI #ifdef FEAT_GUI
int delay = 1; int delay = 1;
@@ -4195,23 +3943,6 @@ mch_system_classic(char *cmd, int options)
/* Get the command exit code */ /* Get the command exit code */
GetExitCodeProcess(pi.hProcess, &ret); GetExitCodeProcess(pi.hProcess, &ret);
} }
else
{
/*
* This ugly code is the only quick way of performing
* a synchronous spawn under Win32s. Yuk.
*/
num_windows = 0;
EnumWindows(win32ssynch_cb, 0);
old_num_windows = num_windows;
do
{
Sleep(1000);
num_windows = 0;
EnumWindows(win32ssynch_cb, 0);
} while (num_windows == old_num_windows);
ret = 0;
}
/* Close the handles to the subprocess, so that it goes away */ /* Close the handles to the subprocess, so that it goes away */
CloseHandle(pi.hThread); CloseHandle(pi.hThread);
@@ -4453,11 +4184,11 @@ mch_system_piped(char *cmd, int options)
if ( ! CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr, 0) if ( ! CreatePipe(&g_hChildStd_OUT_Rd, &g_hChildStd_OUT_Wr, &saAttr, 0)
/* Ensure the read handle to the pipe for STDOUT is not inherited. */ /* Ensure the read handle to the pipe for STDOUT is not inherited. */
|| ! pSetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0) || ! SetHandleInformation(g_hChildStd_OUT_Rd, HANDLE_FLAG_INHERIT, 0)
/* Create a pipe for the child process's STDIN. */ /* Create a pipe for the child process's STDIN. */
|| ! CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr, 0) || ! CreatePipe(&g_hChildStd_IN_Rd, &g_hChildStd_IN_Wr, &saAttr, 0)
/* Ensure the write handle to the pipe for STDIN is not inherited. */ /* Ensure the write handle to the pipe for STDIN is not inherited. */
|| ! pSetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0) ) || ! SetHandleInformation(g_hChildStd_IN_Wr, HANDLE_FLAG_INHERIT, 0) )
{ {
CloseHandle(g_hChildStd_IN_Rd); CloseHandle(g_hChildStd_IN_Rd);
CloseHandle(g_hChildStd_IN_Wr); CloseHandle(g_hChildStd_IN_Wr);
@@ -4707,7 +4438,7 @@ mch_system_piped(char *cmd, int options)
mch_system(char *cmd, int options) mch_system(char *cmd, int options)
{ {
/* if we can pipe and the shelltemp option is off */ /* if we can pipe and the shelltemp option is off */
if (allowPiping && !p_stmp) if (!p_stmp)
return mch_system_piped(cmd, options); return mch_system_piped(cmd, options);
else else
return mch_system_classic(cmd, options); return mch_system_classic(cmd, options);
@@ -4960,7 +4691,7 @@ mch_call_shell(
{ {
cmdlen = ( cmdlen = (
#ifdef FEAT_GUI_W32 #ifdef FEAT_GUI_W32
(allowPiping && !p_stmp ? 0 : STRLEN(vimrun_path)) + (!p_stmp ? 0 : STRLEN(vimrun_path)) +
#endif #endif
STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10); STRLEN(p_sh) + STRLEN(p_shcf) + STRLEN(cmd) + 10);
@@ -4978,7 +4709,7 @@ mch_call_shell(
MB_ICONWARNING); MB_ICONWARNING);
need_vimrun_warning = FALSE; need_vimrun_warning = FALSE;
} }
if (!s_dont_use_vimrun && (!allowPiping || p_stmp)) if (!s_dont_use_vimrun && p_stmp)
/* Use vimrun to execute the command. It opens a console /* Use vimrun to execute the command. It opens a console
* window, which can be closed without killing Vim. */ * window, which can be closed without killing Vim. */
vim_snprintf((char *)newcmd, cmdlen, "%s%s%s %s %s", vim_snprintf((char *)newcmd, cmdlen, "%s%s%s %s %s",
@@ -5002,8 +4733,7 @@ mch_call_shell(
/* Print the return value, unless "vimrun" was used. */ /* Print the return value, unless "vimrun" was used. */
if (x != 0 && !(options & SHELL_SILENT) && !emsg_silent if (x != 0 && !(options & SHELL_SILENT) && !emsg_silent
#if defined(FEAT_GUI_W32) #if defined(FEAT_GUI_W32)
&& ((options & SHELL_DOOUT) || s_dont_use_vimrun && ((options & SHELL_DOOUT) || s_dont_use_vimrun || !p_stmp)
|| (allowPiping && !p_stmp))
#endif #endif
) )
{ {
@@ -5051,14 +4781,10 @@ job_io_file_open(
lpSecurityAttributes, dwCreationDisposition, lpSecurityAttributes, dwCreationDisposition,
dwFlagsAndAttributes, NULL); dwFlagsAndAttributes, NULL);
vim_free(wn); vim_free(wn);
if (h == INVALID_HANDLE_VALUE
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
wn = NULL;
} }
} }
if (wn == NULL) if (wn == NULL)
# endif # endif
h = CreateFile((LPCSTR)fname, dwDesiredAccess, dwShareMode, h = CreateFile((LPCSTR)fname, dwDesiredAccess, dwShareMode,
lpSecurityAttributes, dwCreationDisposition, lpSecurityAttributes, dwCreationDisposition,
dwFlagsAndAttributes, NULL); dwFlagsAndAttributes, NULL);
@@ -5127,7 +4853,7 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
} }
else if (!use_null_for_in && else if (!use_null_for_in &&
(!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0) (!CreatePipe(&ifd[0], &ifd[1], &saAttr, 0)
|| !pSetHandleInformation(ifd[1], HANDLE_FLAG_INHERIT, 0))) || !SetHandleInformation(ifd[1], HANDLE_FLAG_INHERIT, 0)))
goto failed; goto failed;
if (use_file_for_out) if (use_file_for_out)
@@ -5145,7 +4871,7 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
} }
else if (!use_null_for_out && else if (!use_null_for_out &&
(!CreatePipe(&ofd[0], &ofd[1], &saAttr, 0) (!CreatePipe(&ofd[0], &ofd[1], &saAttr, 0)
|| !pSetHandleInformation(ofd[0], HANDLE_FLAG_INHERIT, 0))) || !SetHandleInformation(ofd[0], HANDLE_FLAG_INHERIT, 0)))
goto failed; goto failed;
if (use_file_for_err) if (use_file_for_err)
@@ -5163,7 +4889,7 @@ mch_start_job(char *cmd, job_T *job, jobopt_T *options)
} }
else if (!use_out_for_err && !use_null_for_err && else if (!use_out_for_err && !use_null_for_err &&
(!CreatePipe(&efd[0], &efd[1], &saAttr, 0) (!CreatePipe(&efd[0], &efd[1], &saAttr, 0)
|| !pSetHandleInformation(efd[0], HANDLE_FLAG_INHERIT, 0))) || !SetHandleInformation(efd[0], HANDLE_FLAG_INHERIT, 0)))
goto failed; goto failed;
si.dwFlags |= STARTF_USESTDHANDLES; si.dwFlags |= STARTF_USESTDHANDLES;
@@ -6176,9 +5902,7 @@ mch_remove(char_u *name)
{ {
n = DeleteFileW(wn) ? 0 : -1; n = DeleteFileW(wn) ? 0 : -1;
vim_free(wn); vim_free(wn);
if (n == 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return n; return n;
/* Retry with non-wide function (for Windows 98). */
} }
} }
#endif #endif
@@ -6203,7 +5927,6 @@ mch_breakcheck(int force)
/* physical RAM to leave for the OS */ /* physical RAM to leave for the OS */
#define WINNT_RESERVE_BYTES (256*1024*1024) #define WINNT_RESERVE_BYTES (256*1024*1024)
#define WIN95_RESERVE_BYTES (8*1024*1024)
/* /*
* How much main memory in KiB that can be used by VIM. * How much main memory in KiB that can be used by VIM.
@@ -6212,12 +5935,9 @@ mch_breakcheck(int force)
long_u long_u
mch_total_mem(int special) mch_total_mem(int special)
{ {
PlatformId();
#if (defined(_MSC_VER) && (WINVER > 0x0400)) || defined(MEMORYSTATUSEX)
if (g_PlatformId == VER_PLATFORM_WIN32_NT)
{
MEMORYSTATUSEX ms; MEMORYSTATUSEX ms;
PlatformId();
/* Need to use GlobalMemoryStatusEx() when there is more memory than /* Need to use GlobalMemoryStatusEx() when there is more memory than
* what fits in 32 bits. But it's not always available. */ * what fits in 32 bits. But it's not always available. */
ms.dwLength = sizeof(MEMORYSTATUSEX); ms.dwLength = sizeof(MEMORYSTATUSEX);
@@ -6234,32 +5954,6 @@ mch_total_mem(int special)
} }
/* Use physical RAM less reserve for OS + data. */ /* Use physical RAM less reserve for OS + data. */
return (long_u)((ms.ullTotalPhys - WINNT_RESERVE_BYTES) / 1024); return (long_u)((ms.ullTotalPhys - WINNT_RESERVE_BYTES) / 1024);
}
else
#endif
{
/* Pre-XP or 95 OS handling. */
MEMORYSTATUS ms;
long_u os_reserve_bytes;
ms.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&ms);
if (ms.dwAvailVirtual < ms.dwTotalPhys)
{
/* Process address space fits in physical RAM, use all of it. */
return (long_u)(ms.dwAvailVirtual / 1024);
}
os_reserve_bytes = (g_PlatformId == VER_PLATFORM_WIN32_NT)
? WINNT_RESERVE_BYTES
: WIN95_RESERVE_BYTES;
if (ms.dwTotalPhys <= os_reserve_bytes)
{
/* Catch old boxes or perverse hardware setup. */
return (long_u)((ms.dwTotalPhys / 2) / 1024);
}
/* Use physical RAM less reserve for OS + data. */
return (long_u)((ms.dwTotalPhys - os_reserve_bytes) / 1024);
}
} }
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
@@ -6276,8 +5970,6 @@ mch_wrename(WCHAR *wold, WCHAR *wnew)
WCHAR szNewPath[_MAX_PATH + 1]; WCHAR szNewPath[_MAX_PATH + 1];
HANDLE hf; HANDLE hf;
if (!mch_windows95())
{
p = wold; p = wold;
for (i = 0; wold[i] != NUL; ++i) for (i = 0; wold[i] != NUL; ++i)
if ((wold[i] == '/' || wold[i] == '\\' || wold[i] == ':') if ((wold[i] == '/' || wold[i] == '\\' || wold[i] == ':')
@@ -6285,7 +5977,6 @@ mch_wrename(WCHAR *wold, WCHAR *wnew)
p = wold + i + 1; p = wold + i + 1;
if ((int)(wold + i - p) < 8 || p[6] != '~') if ((int)(wold + i - p) < 8 || p[6] != '~')
return (MoveFileW(wold, wnew) == 0); return (MoveFileW(wold, wnew) == 0);
}
if (GetFullPathNameW(wnew, _MAX_PATH, szNewPath, &p) == 0 || p == NULL) if (GetFullPathNameW(wnew, _MAX_PATH, szNewPath, &p) == 0 || p == NULL)
return -1; return -1;
@@ -6363,22 +6054,17 @@ mch_rename(
retval = mch_wrename(wold, wnew); retval = mch_wrename(wold, wnew);
vim_free(wold); vim_free(wold);
vim_free(wnew); vim_free(wnew);
if (retval == 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
return retval; return retval;
/* Retry with non-wide function (for Windows 98). */
} }
#endif #endif
/* /*
* No need to play tricks if not running Windows 95, unless the file name * No need to play tricks unless the file name contains a "~" as the
* contains a "~" as the seventh character. * seventh character.
*/ */
if (!mch_windows95())
{
pszFilePart = (char *)gettail((char_u *)pszOldFile); pszFilePart = (char *)gettail((char_u *)pszOldFile);
if (STRLEN(pszFilePart) < 8 || pszFilePart[6] != '~') if (STRLEN(pszFilePart) < 8 || pszFilePart[6] != '~')
return rename(pszOldFile, pszNewFile); return rename(pszOldFile, pszNewFile);
}
/* Get base path of new file name. Undocumented feature: If pszNewFile is /* Get base path of new file name. Undocumented feature: If pszNewFile is
* a directory, no error is returned and pszFilePart will be NULL. */ * a directory, no error is returned and pszFilePart will be NULL. */
@@ -6441,16 +6127,9 @@ mch_rename(
char * char *
default_shell(void) default_shell(void)
{ {
char* psz = NULL;
PlatformId(); PlatformId();
if (g_PlatformId == VER_PLATFORM_WIN32_NT) /* Windows NT */ return "cmd.exe";
psz = "cmd.exe";
else if (g_PlatformId == VER_PLATFORM_WIN32_WINDOWS) /* Windows 95 */
psz = "command.com";
return psz;
} }
/* /*
@@ -6496,18 +6175,11 @@ mch_access(char *n, int p)
hFile = FindFirstFileW(TempNameW, &d); hFile = FindFirstFileW(TempNameW, &d);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{
if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
goto getout; goto getout;
/* Retry with non-wide function (for Windows 98). */
vim_free(wn);
wn = NULL;
}
else else
(void)FindClose(hFile); (void)FindClose(hFile);
} }
if (wn == NULL) else
#endif #endif
{ {
char *pch; char *pch;
@@ -6537,18 +6209,11 @@ mch_access(char *n, int p)
if (wn != NULL) if (wn != NULL)
{ {
if (!GetTempFileNameW(wn, L"VIM", 0, TempNameW)) if (!GetTempFileNameW(wn, L"VIM", 0, TempNameW))
{
if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
goto getout; goto getout;
/* Retry with non-wide function (for Windows 98). */
vim_free(wn);
wn = NULL;
}
else else
DeleteFileW(TempNameW); DeleteFileW(TempNameW);
} }
if (wn == NULL) else
#endif #endif
{ {
if (!GetTempFileName(n, "VIM", 0, TempName)) if (!GetTempFileName(n, "VIM", 0, TempName))
@@ -6565,17 +6230,8 @@ mch_access(char *n, int p)
| ((p & R_OK) ? GENERIC_READ : 0); | ((p & R_OK) ? GENERIC_READ : 0);
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (wn != NULL) if (wn != NULL)
{
hFile = CreateFileW(wn, am, 0, NULL, OPEN_EXISTING, 0, NULL); hFile = CreateFileW(wn, am, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hFile == INVALID_HANDLE_VALUE else
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{
/* Retry with non-wide function (for Windows 98). */
vim_free(wn);
wn = NULL;
}
}
if (wn == NULL)
#endif #endif
hFile = CreateFile(n, am, 0, NULL, OPEN_EXISTING, 0, NULL); hFile = CreateFile(n, am, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
@@ -6610,11 +6266,7 @@ mch_open(char *name, int flags, int mode)
{ {
f = _wopen(wn, flags, mode); f = _wopen(wn, flags, mode);
vim_free(wn); vim_free(wn);
if (f >= 0 || g_PlatformId == VER_PLATFORM_WIN32_NT)
return f; return f;
/* Retry with non-wide function (for Windows 98). Can't use
* GetLastError() here and it's unclear what errno gets set to if
* the _wopen() fails for missing wide functions. */
} }
} }
# endif # endif
@@ -6638,12 +6290,7 @@ mch_fopen(char *name, char *mode)
WCHAR *wn, *wm; WCHAR *wn, *wm;
FILE *f = NULL; FILE *f = NULL;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
# ifdef __BORLANDC__
/* Wide functions of Borland C 5.5 do not work on Windows 98. */
&& g_PlatformId == VER_PLATFORM_WIN32_NT
# endif
)
{ {
# if defined(DEBUG) && _MSC_VER >= 1400 # if defined(DEBUG) && _MSC_VER >= 1400
/* Work around an annoying assertion in the Microsoft debug CRT /* Work around an annoying assertion in the Microsoft debug CRT
@@ -6667,12 +6314,7 @@ mch_fopen(char *name, char *mode)
# if defined(DEBUG) && _MSC_VER >= 1400 # if defined(DEBUG) && _MSC_VER >= 1400
_set_fmode(oldMode); _set_fmode(oldMode);
# endif # endif
if (f != NULL || g_PlatformId == VER_PLATFORM_WIN32_NT)
return f; return f;
/* Retry with non-wide function (for Windows 98). Can't use
* GetLastError() here and it's unclear what errno gets set to if
* the _wfopen() fails for missing wide functions. */
} }
/* fopen() can open a file which name is longer than _MAX_PATH bytes /* fopen() can open a file which name is longer than _MAX_PATH bytes
@@ -6843,7 +6485,6 @@ mch_copy_file_attribute(char_u *from, char_u *to)
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
/* File streams only work on Windows NT and later. */ /* File streams only work on Windows NT and later. */
PlatformId(); PlatformId();
if (g_PlatformId == VER_PLATFORM_WIN32_NT)
copy_infostreams(from, to); copy_infostreams(from, to);
#endif #endif
return 0; return 0;
@@ -6856,7 +6497,6 @@ mch_copy_file_attribute(char_u *from, char_u *to)
*/ */
/* These magic numbers are from the MS header files */ /* These magic numbers are from the MS header files */
#define MIN_STACK_WIN9X 17
#define MIN_STACK_WINNT 2 #define MIN_STACK_WINNT 2
/* /*
@@ -6876,10 +6516,7 @@ myresetstkoflw(void)
DWORD nPageSize; DWORD nPageSize;
DWORD dummy; DWORD dummy;
/* This code will not work on win32s. */
PlatformId(); PlatformId();
if (g_PlatformId == VER_PLATFORM_WIN32s)
return 0;
/* We need to know the system page size. */ /* We need to know the system page size. */
GetSystemInfo(&si); GetSystemInfo(&si);
@@ -6895,29 +6532,12 @@ myresetstkoflw(void)
/* ...and the page thats min_stack_req pages away from stack base; this is /* ...and the page thats min_stack_req pages away from stack base; this is
* the lowest page we could use. */ * the lowest page we could use. */
pLowestPossiblePage = pStackBase + ((g_PlatformId == VER_PLATFORM_WIN32_NT) pLowestPossiblePage = pStackBase + MIN_STACK_WINNT * nPageSize;
? MIN_STACK_WINNT : MIN_STACK_WIN9X) * nPageSize;
/* On Win95, we want the next page down from the end of the stack. */
if (g_PlatformId == VER_PLATFORM_WIN32_WINDOWS)
{ {
/* Find the page that's only 1 page down from the page that the stack /* We want the first committed page in the stack Start at the stack
* ptr is in. */ * base and move forward through memory until we find a committed block.
pGuardPage = (BYTE*)((DWORD)nPageSize * (((DWORD)pStackPtr */
/ (DWORD)nPageSize) - 1));
if (pGuardPage < pLowestPossiblePage)
return 0;
/* Apply the noaccess attribute to the page -- there's no guard
* attribute in win95-type OSes. */
if (!VirtualProtect(pGuardPage, nPageSize, PAGE_NOACCESS, &dummy))
return 0;
}
else
{
/* On NT, however, we want the first committed page in the stack Start
* at the stack base and move forward through memory until we find a
* committed block. */
BYTE *pBlock = pStackBase; BYTE *pBlock = pStackBase;
for (;;) for (;;)

View File

@@ -210,20 +210,15 @@ Trace(char *pszFormat, ...);
# define vim_mkdir(x, y) mch_mkdir(x) # define vim_mkdir(x, y) mch_mkdir(x)
#endif #endif
#ifndef PROTO
/* Enable common dialogs input unicode from IME if possible. */ /* Enable common dialogs input unicode from IME if possible. */
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
/* The variables are defined in os_win32.c. */ # define pDispatchMessage DispatchMessageW
extern LRESULT (WINAPI *pDispatchMessage)(CONST MSG *); # define pGetMessage GetMessageW
extern BOOL (WINAPI *pGetMessage)(LPMSG, HWND, UINT, UINT); # define pIsDialogMessage IsDialogMessageW
extern BOOL (WINAPI *pIsDialogMessage)(HWND, LPMSG); # define pPeekMessage PeekMessageW
extern BOOL (WINAPI *pPeekMessage)(LPMSG, HWND, UINT, UINT, UINT);
#else #else
# define pDispatchMessage DispatchMessage # define pDispatchMessage DispatchMessage
# define pGetMessage GetMessage # define pGetMessage GetMessage
# define pIsDialogMessage IsDialogMessage # define pIsDialogMessage IsDialogMessage
# define pPeekMessage PeekMessage # define pPeekMessage PeekMessage
#endif #endif
#endif /* PROTO */

View File

@@ -19,7 +19,6 @@ void display_errors(void);
int mch_has_exp_wildcard(char_u *p); int mch_has_exp_wildcard(char_u *p);
int mch_has_wildcard(char_u *p); int mch_has_wildcard(char_u *p);
int mch_chdir(char *path); int mch_chdir(char *path);
int can_end_termcap_mode(int give_msg);
int mch_screenmode(char_u *arg); int mch_screenmode(char_u *arg);
int mch_icon_load(HANDLE *iconp); int mch_icon_load(HANDLE *iconp);
int mch_libcall(char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result); int mch_libcall(char_u *libname, char_u *funcname, char_u *argstring, int argint, char_u **string_result, int *number_result);

View File

@@ -3,7 +3,6 @@ HINSTANCE vimLoadLib(char *name);
int dyn_libintl_init(void); int dyn_libintl_init(void);
void dyn_libintl_end(void); void dyn_libintl_end(void);
void PlatformId(void); void PlatformId(void);
int mch_windows95(void);
void mch_setmouse(int on); void mch_setmouse(int on);
void mch_update_cursor(void); void mch_update_cursor(void);
int mch_char_avail(void); int mch_char_avail(void);

View File

@@ -764,6 +764,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
29,
/**/ /**/
28, 28,
/**/ /**/
@@ -962,16 +964,11 @@ list_version(void)
MSG(longVersion); MSG(longVersion);
#ifdef WIN3264 #ifdef WIN3264
# ifdef FEAT_GUI_W32 # ifdef FEAT_GUI_W32
# if defined(_MSC_VER) && (_MSC_VER <= 1010)
/* Only MS VC 4.1 and earlier can do Win32s */
MSG_PUTS(_("\nMS-Windows 16/32-bit GUI version"));
# else
# ifdef _WIN64 # ifdef _WIN64
MSG_PUTS(_("\nMS-Windows 64-bit GUI version")); MSG_PUTS(_("\nMS-Windows 64-bit GUI version"));
# else # else
MSG_PUTS(_("\nMS-Windows 32-bit GUI version")); MSG_PUTS(_("\nMS-Windows 32-bit GUI version"));
# endif # endif
# endif
# ifdef FEAT_OLE # ifdef FEAT_OLE
MSG_PUTS(_(" with OLE support")); MSG_PUTS(_(" with OLE support"));
# endif # endif
@@ -1332,10 +1329,6 @@ intro_message(
blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1); blanklines = (int)Rows - ((sizeof(lines) / sizeof(char *)) - 1);
if (!p_cp) if (!p_cp)
blanklines += 4; /* add 4 for not showing "Vi compatible" message */ blanklines += 4; /* add 4 for not showing "Vi compatible" message */
#if defined(WIN3264) && !defined(FEAT_GUI_W32)
if (mch_windows95())
blanklines -= 3; /* subtract 3 for showing "Windows 95" message */
#endif
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
/* Don't overwrite a statusline. Depends on 'cmdheight'. */ /* Don't overwrite a statusline. Depends on 'cmdheight'. */
@@ -1384,17 +1377,6 @@ intro_message(
do_intro_line(row, (char_u *)_(p), i == 2, 0); do_intro_line(row, (char_u *)_(p), i == 2, 0);
++row; ++row;
} }
#if defined(WIN3264) && !defined(FEAT_GUI_W32)
if (mch_windows95())
{
do_intro_line(++row,
(char_u *)_("WARNING: Windows 95/98/ME detected"),
FALSE, hl_attr(HLF_E));
do_intro_line(++row,
(char_u *)_("type :help windows95<Enter> for info on this"),
FALSE, 0);
}
#endif
} }
/* Make the wait-return message appear just below the text. */ /* Make the wait-return message appear just below the text. */