1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* win32/win32.c (get_pioinfo_extra): new function for VC++8 SP1

workaround. [ruby-core:10259]

* win32/win32.c (NtInitialize): call above function.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2007-02-15 11:50:28 +00:00
parent ea51ff20ac
commit 691b6fb869
3 changed files with 59 additions and 2 deletions

View file

@ -1,3 +1,10 @@
Thu Feb 15 20:48:36 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.c (get_pioinfo_extra): new function for VC++8 SP1
workaround. [ruby-core:10259]
* win32/win32.c (NtInitialize): call above function.
Thu Feb 15 16:25:54 2007 Akinori MUSHA <knu@iDaemons.org> Thu Feb 15 16:25:54 2007 Akinori MUSHA <knu@iDaemons.org>
* lib/uri/generic.rb (URI::Generic::userinfo): Considering how * lib/uri/generic.rb (URI::Generic::userinfo): Considering how

View file

@ -143,7 +143,7 @@ RFLAGS = -r
!if !defined(EXTLIBS) !if !defined(EXTLIBS)
EXTLIBS = EXTLIBS =
!endif !endif
LIBS = oldnames.lib user32.lib advapi32.lib shell32.lib ws2_32.lib $(EXTLIBS) LIBS = oldnames.lib user32.lib advapi32.lib shell32.lib version.lib ws2_32.lib $(EXTLIBS)
MISSING = acosh.obj crypt.obj erf.obj win32.obj MISSING = acosh.obj crypt.obj erf.obj win32.obj
ARFLAGS = -machine:$(MACHINE) -out: ARFLAGS = -machine:$(MACHINE) -out:

View file

@ -451,7 +451,10 @@ NtInitialize(int *argc, char ***argv)
int ret; int ret;
#if _MSC_VER >= 1400 #if _MSC_VER >= 1400
static void set_pioinfo_extra(void);
_set_invalid_parameter_handler(invalid_parameter); _set_invalid_parameter_handler(invalid_parameter);
set_pioinfo_extra();
#endif #endif
// //
@ -1669,9 +1672,56 @@ typedef struct {
#if !defined(__BORLANDC__) && !defined(_WIN32_WCE) #if !defined(__BORLANDC__) && !defined(_WIN32_WCE)
EXTERN_C _CRTIMP ioinfo * __pioinfo[]; EXTERN_C _CRTIMP ioinfo * __pioinfo[];
#if _MSC_VER >= 1400
static size_t pioinfo_extra = 0; /* workaround for VC++8 SP1 */
static void
set_pioinfo_extra(void)
{
char libpath[MAXPATHLEN+1];
HMODULE msvcrt = NULL;
MEMORY_BASIC_INFORMATION m;
DWORD dummy;
DWORD size;
void *buf;
VS_FIXEDFILEINFO *pffi;
int major, minor, teeny, build;
memset(&m, 0, sizeof(m));
if (VirtualQuery(stdin, &m, sizeof(m)) && m.State == MEM_COMMIT)
msvcrt = (HMODULE)m.AllocationBase;
if (!msvcrt)
return;
if (!GetModuleFileName(msvcrt, libpath, sizeof(libpath)))
return;
size = GetFileVersionInfoSize(libpath, &dummy);
if (size == 0)
return;
buf = malloc(size);
if (!GetFileVersionInfo(libpath, 0, size, buf) ||
!VerQueryValue(buf, "\\", &pffi, &dummy)) {
free(buf);
return;
}
major = HIWORD(pffi->dwFileVersionMS);
minor = LOWORD(pffi->dwFileVersionMS);
teeny = HIWORD(pffi->dwFileVersionLS);
build = LOWORD(pffi->dwFileVersionLS);
free(buf);
if (major == 8 && minor == 0 &&
(teeny > 50727 || (teeny == 50727 && build >= 762))) {
pioinfo_extra = 16;
}
}
#else
#define pioinfo_extra 0
#endif
#define IOINFO_L2E 5 #define IOINFO_L2E 5
#define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E) #define IOINFO_ARRAY_ELTS (1 << IOINFO_L2E)
#define _pioinfo(i) (__pioinfo[i >> IOINFO_L2E] + (i & (IOINFO_ARRAY_ELTS - 1))) #define _pioinfo(i) ((ioinfo*)((char*)(__pioinfo[i >> IOINFO_L2E]) + (i & (IOINFO_ARRAY_ELTS - 1)) * (sizeof(ioinfo) + pioinfo_extra)))
#define _osfhnd(i) (_pioinfo(i)->osfhnd) #define _osfhnd(i) (_pioinfo(i)->osfhnd)
#define _osfile(i) (_pioinfo(i)->osfile) #define _osfile(i) (_pioinfo(i)->osfile)
#define _pipech(i) (_pioinfo(i)->pipech) #define _pipech(i) (_pioinfo(i)->pipech)