After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 150746 - GTK+ doesn't run on Windows 95
GTK+ doesn't run on Windows 95
Status: RESOLVED WONTFIX
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.4.x
Other Windows
: Normal normal
: Medium fix
Assigned To: gtk-win32 maintainers
gtk-bugs
: 150747 150748 158547 163498 167240 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2004-08-22 02:12 UTC by Alejandro Jakubi
Modified: 2006-04-19 10:19 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Emulating the missing Win95 functions GetFileAttributesExA and ExW (6.76 KB, text/plain)
2005-05-12 15:08 UTC, llcSawyer
  Details
test.c for emulate_GetFileAttributesEx (9.67 KB, text/plain)
2005-05-30 16:22 UTC, llcSawyer
  Details
NewAPIs.h (Only GetFileAttributesEx wrapper) (4.88 KB, text/plain)
2005-05-30 16:27 UTC, llcSawyer
  Details
suggested changes to file gtkfilesystemwin32.c (6.42 KB, text/plain)
2005-05-30 16:30 UTC, llcSawyer
  Details
Using only FindFirstFile (2.00 KB, text/plain)
2005-06-05 12:50 UTC, llcSawyer
  Details
patch (6.66 KB, patch)
2005-07-21 17:31 UTC, llcSawyer
none Details | Review
test the patch (10.93 KB, text/plain)
2005-07-21 17:34 UTC, llcSawyer
  Details

Description Alejandro Jakubi 2004-08-22 02:12:05 UTC
I have found that dia does not start on Win 95. Versions are dia-win32-installer
0.94-pre1 and Win 95 4.00.950 B. I get this error message:

Error starting program
The LIBGTK-WIN32-2.0-0.DLL file is linked to missing export
KERNEL32.DLL:GetFileAttributesExA

Indeed Win 95 KERNEL32.DLL has similarly named exports: GetFileAttributesA and
GetFileAttributesW, but not GetFileAttributesExA.
Comment 1 Steffen Macke 2004-08-22 04:13:00 UTC
*** Bug 150748 has been marked as a duplicate of this bug. ***
Comment 2 Steffen Macke 2004-08-22 04:13:28 UTC
*** Bug 150747 has been marked as a duplicate of this bug. ***
Comment 3 Steffen Macke 2004-08-22 04:15:17 UTC
This is rather a GTK+ bug than a dia bug.
Comment 4 Robert Ögren 2004-08-22 12:12:27 UTC
(Bug is not assigned correctly; reassigning to component owner - GTK Win32
maintainers)

GetFileAttributesEx is called from filename_get_info() in gtk/gtkfilesystemwin32.c

The discussion in bug #137543 is relevant. Is this a WONTFIX (Win95 support
dropped)?
Comment 5 Tor Lillqvist 2004-08-22 15:45:44 UTC
It's not WONTFIX, it's WILLWHOEVERFEELSSTRONGLYFORITSUBMITAPATCHTHANKS ;-)
Comment 6 Hans Breuer 2004-08-22 16:14:09 UTC
aggreeing with Tor (especially as GetFileAttributeEx isn't the only function
missing under win95). The least someone interested in gtk+ running under win95 -
and thus having access to one - needs to check exactly which functions are
additionally missing. You can do this by running depends.exe on
gtk-win32-2.0.dll (or dia.exe) and write down every symbol from every DLL used
which has a red icon near to it. I suspect these are at least the additional
ones mentioned in my comment to bug #137543 (pasted below) :

- afaik win95 (not win9x!) support of gtk is broken for years (to 
  me it is very reasonable to use functions introduced with win98
  unconditional, like GetFileAttributesEx). There are other functions
  in the dependency stack already, e.g. InterlockedExchange*() which
  simply are not available for win95 (iirc with win98 the 80386
  support was dropped and they require a 486 at least, or was it a
  pentium? )
Comment 7 Tor Lillqvist 2004-08-22 16:25:31 UTC
> e.g. InterlockedExchange*() which simply are not available for win95 

Yes but my DLLs, being built with gcc, don't use that, but the inline assembly 
code ;-)
Comment 8 Robert Ögren 2004-11-17 18:02:49 UTC
*** Bug 158547 has been marked as a duplicate of this bug. ***
Comment 9 Mark 2004-11-24 19:18:29 UTC
See this page on Microsoft's web site:
http://msdn.microsoft.com/library/en-us/fileio/base/getfileattributesex.asp

Quoting from there:
"Windows NT Server 3.51 and earlier, Windows 95:  Include an additional header 
file called NewAPIs.h to make GetFileAttributesEx available on these operating 
systems. The function is not implemented natively, but by a wrapper that 
utilizes other native functions on these systems. See the header file for 
details of the use of preprocessor directives that make the function available. 
If you do not have this header file, it can be obtained by downloading the most 
recent Windows SDK from the SDK Update Site."

So the GetFileAttributesExA bug should be trivial to fix. Examine Microsoft's 
NewAPIs.h header file and use it, or create an equivalent.

-- Mark
Comment 10 Tor Lillqvist 2004-11-24 23:01:26 UTC
Thers is no NewAPIs.h in the headers used when building GTK etc with gcc. 
(Those headers are a clean-room rewrite, not copied from Microsoft's.) Nor is 
NewAPIs.h present in MSVC6's headers, although MSVC5 users probably want to use 
fresh Platform SDK headers anyway.

Instead, whoever feels strongly for this needs to submit a patch that does the 
following:

- Looks up GetFileAtributesExA at run-time (just once) from kernel32.dll
- Uses result of above look-up if found
- Otherwise uses FindFirstFile.

Comment 11 Tor Lillqvist 2005-01-09 23:00:56 UTC
*** Bug 163498 has been marked as a duplicate of this bug. ***
Comment 12 Morten Welinder 2005-02-13 15:20:00 UTC
*** Bug 167240 has been marked as a duplicate of this bug. ***
Comment 13 llcSawyer 2005-05-12 15:08:53 UTC
Created attachment 46371 [details]
Emulating the missing Win95 functions GetFileAttributesExA and ExW

I have a solution to this bug. The problem has doubled in size after it was
reported in 2004-08-22. In GTK+ version 2.4.14, GetFileAttributesExA was the
only function missing in Win95. In version 2.6.7, there is another function
missing from Win95, GetFileAttributesExW. These two functions are only called
in one place: inside gtkfilesystemwin32.c by static function filename_get_info,
which is only called by gtk_file_folder_win32_get_info. My solution emulates
the two missing functions, GetFileAttributesExA{W}. 

The file attachment is inserted into gtkfilesystemwin32.c: MAR 20 2005	12:25AM
gtk+-2.6.7 The correction goes in front of function filename_get_info . Yes, I
know that a diff of the changes would be very, very nice but I have this
problem with GNU Diffutils for Windows: "DIFF caused an invalid page fault in
module MSVCRT.DLL at 013f:780029e5."  All I really care about is Inkscape on
Win95
      <
https://sourceforge.net/tracker/?func=detail&atid=604306&aid=1188352&group_id=93438
>
I get this error message from Inkscape: The LIBGTK-WIN32-2.0-0.DLL file is
linked to missing export KERNEL32.DLL:GetFileAttributesExA

In the file attachment, I did something dubious by using these macros:
#define GetFileAttributesExA PROBE_GetFileAttributesExA
#define GetFileAttributesExW PROBE_GetFileAttributesExW
Function PROBE_GetFileAttributesExA{W} decides if the real
GetFileAttributesExA{W} is available in KERNEL32.DLL or must instead be
emulated.

For reference on how Microsoft solved this very same bug, NewAPIs.h is
available. It is temporarily at Google cache snapshot for
"WANT_GETFILEATTRIBUTESEX_WRAPPER" which is the same as 
	  < http://snipurl.com/e6x7 >
Comment 14 llcSawyer 2005-05-30 16:22:28 UTC
Created attachment 47044 [details]
test.c  for emulate_GetFileAttributesEx
Comment 15 llcSawyer 2005-05-30 16:27:51 UTC
Created attachment 47045 [details]
NewAPIs.h (Only GetFileAttributesEx wrapper)
Comment 16 llcSawyer 2005-05-30 16:30:49 UTC
Created attachment 47046 [details]
suggested changes to file gtkfilesystemwin32.c
Comment 17 Tor Lillqvist 2005-05-31 09:04:23 UTC
So, which part of "Copyright (c) 1997-1999, Microsoft Corporation" do you not
understand?
Comment 18 llcSawyer 2005-06-01 19:58:16 UTC
Sitting for minutes I was embarrassed by what I had done, but I persist. I 
really want this bug fixed and that will require work by the GTK+ leaders. 
Because of Comments #9 and 10, a short quote from a very much longer NewAPIs.h 
is attached for reference only. It is not to become a part of GTK+. But I 
believe Microsoft does allow use of this particular header. What you can do 
with the code is limited by the "fair use" provisions of the copyright law. If 
the very strong words "all rights reserved" had also been used, that would 
indicate "if you copy our software without our permission, you will hear from 
our lawyer." 

An example using the much stronger words "all rights reserved":
/*
 * Copyright (c) 1994 by P.J. Plauger.  ALL RIGHTS RESERVED. 
 * Consult your license regarding permissions and restrictions.
 */

Another:
// Copyright 1986 - 1998 Microsoft Corporation.  All Rights Reserved.

With regrets for possibly offending copyrights,
llcSawyer


Comment 19 Olav Vitters 2005-06-01 20:20:03 UTC
llcSawyer: Please convince Microsoft to release that code to the public domain
or LGPL (or whatever it required by GTK+). We cannot break copyright, no matter
how much it is wanted.
The "All right reserved" has nothing to do with copyright. Since the Berne
convention, even the 'Copyright (c)' can be left out (it is automatically
copyrighted).
Comment 20 llcSawyer 2005-06-05 12:50:56 UTC
Created attachment 47268 [details]
Using only FindFirstFile

The attachment uses only FindFirstFile and never calls GetFileAttributesEx. And
there are no special functions to only support Win95 or WinNT 3.1 and later.
Can you use this idea?
Comment 21 Tor Lillqvist 2005-07-17 22:44:29 UTC
Unfortunately FindFirstFile() doesn't work for the root of drives. (It even says
so in the documentation.) Try again.
Comment 22 llcSawyer 2005-07-21 17:31:47 UTC
Created attachment 49530 [details] [review]
patch

FindFirstFileA() doesn't work for a Win95 root directory. But it does work for
a WinXP NTFS root directory "C:". But, then again, it does not work for a WinXP
FAT32 root directory "D:", in a system recovery partition. The patch handles
this inconsistency between Win95 and WinXP.
Comment 23 llcSawyer 2005-07-21 17:34:10 UTC
Created attachment 49531 [details]
test the patch
Comment 24 Tor Lillqvist 2006-04-19 10:19:44 UTC
Closing as wontfix. If you want to use GTK+ on Windows 95, use some older version that still worked.