Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Contributions to C::B => Topic started by: killerbot on January 07, 2006, 04:19:46 pm

Title: WIN98/9x/others build : registry settings test
Post by: killerbot on January 07, 2006, 04:19:46 pm
Dear All,

Below you can find a link to an ansi build which should run on all win platforms.
More specifially on win9x/Me. The build is based on rev 1667 with a registry patch applied (see other place in this forum for more info). I would like your help/feedback on this.

The Problem :
Currently CB registers the file types in HKEY_CLASSES_ROOT, this creates 2 problems :
 - is forced upon all users of the PC (different users might want different default editors)
 - when you have a restricted user account on the win NT based (winNT/2000/XP/2003) you don't have access to this part of the registry.

Solution:
Starting from win2000 MS offered to have these settings stored in the registry per user, solving the previously mentioned problems) : HKEY_CURRENT_USER\Software\Classes . So we should store the settings there, but since this is not a perfect world, this key probably does not exist on win9x, and in the case it does the question is, will that Windows version consider it and read it in ?
The applied patch will check if that user key exists, if so, it writes the settings at that position, otherwise it writes it at the old global level position.

Things I'd like from those who want to test this (especially win9x):
1) Check if that HKEY_CURRENT_USE\Software\Classes exist on your machine  :  yes/no
2) remove at HKEY_CLASS_ROOT the entries for : (see remark below)
 .cbp .workspace .c .cc .cpp .cxx .h .hh .hpp .hxx    and
CodeBlocks.cbp CodeBlocks.workspace CodeBlocks.c CodeBlocks.cc CodeBlocks.cpp CodeBlocks.cxx CodeBlocks.h CodeBlocks.hh CodeBlocks.hpp CodeBlocks.hxx
3) use the build you can download from the link below (contains all plug-ins and the wx dll), start it up and go to Settings menu -> Environment -> General tab and click on set now
4) check your registry to see where the ended up (the user key or again at the global level)  -> tell me about it please
5) close cb : double click on a cpp file and check if it opens in cb (tell me about it)
6) double click on another cpp file and check if it opens in cb (tell me about it)

In the case you get the error box saying it can't find the fil but actually opens it, that a whole other poblem with DDE, no idea why and how to solve it, but that exist also in the official cb).

REMARK : if you do it like this, you will also lose other information stored at the .cpp .c ... , sometimes additional programs register themselves in there for the open with menu. In case you are in this siutation and you do not want to loose this, then do the test with only the .cbp or .workspace files (but hey, we all want cb to open them ;-) )


The LINK : http://users.pandora.be/lieven.de.cock/CodeBlocks/CB_ansi_rev1667.7z

Many many thanks for your help,
Lieven

Title: Re: WIN98/9x/others build : registry settings test
Post by: thomas on January 07, 2006, 06:48:18 pm
The LINK : http://users.pandora.be/lieven.de.cock/CodeBlocks/CB_ansi_rev1667.7z
Hmm... I have a bad feeling downloading from a server with that name...  :lol:
Title: Re: WIN98/9x/others build : registry settings test
Post by: Maciek on January 08, 2006, 12:11:45 am
WIN98SE here.

1) yes
2) done
3) I did this, but there were some errors. Here you can see what it looked like:

(http://img262.imageshack.us/img262/3130/error4lb.jpg) (http://imageshack.us)

The polish sentence you can see means: "Registry key is not valid" (most probably because of that double backslash)

4) the settings were at user key

5) and 6) files don't open in cb.

Hope that helps.
Title: Re: WIN98/9x/others build : registry settings test
Post by: duncanka on January 08, 2006, 04:15:24 am
1) yes
2) done
3) I did this, but there were some errors.
...
4) the settings were at user key

5) and 6) files don't open in cb.

Hope that helps.
I got identical results, also on Win98SE.
It might interest you to know what I do in fact have in this section of the registry.  I have the following registry subkeys in it:
Nothing that appears to be related to file extensions, unfortunately, except maybe the netscape thing (I have no idea what it means).

Hope that helps, too.
Title: Re: WIN98/9x/others build : registry settings test
Post by: mandrav on January 08, 2006, 09:47:29 am
Lieven,

there is no need to go through this hassle with win98. You seem to forget that it's not a multi-user OS, not in the real sense of the term. HKEY_CLASSES_ROOT is used for windows 98 file associations.
Here is an enlightening read on the subject (http://www.microsoft.com/technet/archive/win98/maintain/assoc.mspx)...
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 08, 2006, 10:36:48 am
thanks for the feedback,
Indeed, there was a bug in the code, so that there were 2 backslashes for the rebuild command. I fixed my code (together with another little bug).

@Yiannis : the reason why I tried it out first like this, so that I did not have to check on the windows version.
But it seems I will have to do it like this, damn.
So I will adjust the code and create a new build.
It seems when on win9x you have that user key, it might be there because some other program had put stuff there although it shows win98 does not look at it to determine the file association. Somewhere else in this thread someone claimed multi user was introduced either in win98SE2 or in winME.
Anyone with WinME ???

Since this key was introduced in win2000, I will now assume it does not exist in Win NT4, anyone who still uses this, please give the above mentioned build a try ??? (maybe some service pack introduced it, but as said :assumption : it does notexist and it's not being looked at).

Therefor : new algo :
if on win9x/Me/winNt4 -> root key, otherwise user key. Will create a new build with this mechanism today, if you all could please try that one again then, many thanks, I owe you all (those who have tested and provided feedback, not all of those who just read this ;-) ) a beer.

Cheers,
Lieven
Title: Re: WIN98/9x/others build : registry settings test
Post by: artoj on January 08, 2006, 10:52:50 am
From Windows 2000 docs (http://www.microsoft.com/resources/documentation/Windows/2000/server/reskit/en-us/Default.asp?url=/resources/documentation/Windows/2000/server/reskit/en-us/regentry/69673.asp)

Quote
In Windows NT 4.0 and earlier, HKEY_CLASSES_ROOT displayed the data only in HKEY_LOCAL_MACHINE\SOFTWARE\Classes. The current, merged configuration lets the system independently register program classes for each user. This feature is known as per-user class registration.

This was introduced in Win2K, so none of the NT 4.0 service packs change this.
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 08, 2006, 10:56:28 am
thanks for the info.

Can someone with WIN2000 tell me what it reports when you execute winver ??

Is that already version 5 ?
(Win XP is version5.1.)
Title: Re: WIN98/9x/others build : registry settings test
Post by: artoj on January 08, 2006, 11:00:47 am
Windows versions:

4.0.950    Windows 95
4.0.1111    Windows 95 OSR 2 & OSR 2.1
4.0.1212    Windows 95 OSR 2.5
4.1.1998    Windows 98
4.1.2222    Windows 98 Second Edition
4.9.3000    Windows Me

Windows NT versions:

4.0.1381    Windows NT 4.0
5.0.2195    Windows 2000
5.01.2600    Windows XP or Windows XP 64-Bit Edition Version 2002 (Itanium)
5.02.3790    Windows Server 2003
   or Windows XP x64 Edition (AMD64/EM64T)
   or Windows XP 64-Bit Edition Version 2003 (Itanium)
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 08, 2006, 11:04:43 am
thanks artoj, you're the greatest.
Title: Re: WIN98/9x/others build : registry settings test
Post by: artoj on January 08, 2006, 11:10:37 am
Oh, and you shouldn't use the last four numbers, just the first two, mening major and minor versions. The last four numbers define which service pack (if any) is installed.

So in pseudo code

Code
if (Version.Major == 5) and (Version.Minor == 0) {
  isWin2k = true;
}
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 08, 2006, 11:18:32 am
New build for a new test : http://users.pandora.be/lieven.de.cock/CodeBlocks/CB_ansi_rev1667(2ND-try).7z

This the the code of the algo :
   // first determine which key to use
   // win9x/ME/NT 4 ->ROOT, others USER
   wxString BaseKeyName(_T("HKEY_CURRENT_USER\\Software\\Classes"));
   int Major = 0;
   int WinFamily = wxGetOsVersion(&Major, NULL);
   if((WinFamily == wxWIN95) || ((WinFamily == wxWINDOWS_NT) && (Major < 5)))
   {
      BaseKeyName = _T("HKEY_CLASSES_ROOT");
   }

Don't use win 3.11 ;-)

I debugged it on in XP, there it seems to work.

Patiently waiting for the test results. Same pocedure as described above, but with the new build.


Thanks,
Lieven
Title: Re: WIN98/9x/others build : registry settings test
Post by: artoj on January 08, 2006, 12:10:06 pm
Using Windows ME.

Things I'd like from those who want to test this (especially win9x):
1) Check if that HKEY_CURRENT_USE\Software\Classes exist on your machine  :  yes/no

Yes, contains only CLSID subkey.

2) remove at HKEY_CLASS_ROOT the entries for : (see remark below)
 .cbp .workspace .c .cc .cpp .cxx .h .hh .hpp .hxx    and
CodeBlocks.cbp CodeBlocks.workspace CodeBlocks.c CodeBlocks.cc CodeBlocks.cpp CodeBlocks.cxx CodeBlocks.h CodeBlocks.hh CodeBlocks.hpp CodeBlocks.hxx

Done.

3) use the build you can download from the link below (contains all plug-ins and the wx dll), start it up and go to Settings menu -> Environment -> General tab and click on set now

Done.

4) check your registry to see where the ended up (the user key or again at the global level)  -> tell me about it please

HKEY_CLASSES_ROOT

5) close cb : double click on a cpp file and check if it opens in cb (tell me about it)

Opens correctly.

6) double click on another cpp file and check if it opens in cb (tell me about it)

Opens correctly.

Now, where's my beer? :P
Title: Re: WIN98/9x/others build : registry settings test
Post by: duncanka on January 08, 2006, 09:09:40 pm
Just tried it on Win98SE.  Same results as artoj.
Still needs someone to test on Win2k+, though, to make sure that still works.
Title: Re: WIN98/9x/others build : registry settings test
Post by: duncanka on January 11, 2006, 01:43:42 am
Below you can find a link to an ansi build which should run on all win platforms.
More specifially on win9x/Me. The build is based on rev 1667 with a registry patch applied (see other place in this forum for more info).
Are there any plans to make any more SVN builds for ANSI/Win98, or at least to have a .cbp file that can be used for such a build, given that you've put in the work to make the code compatible with Win98?
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 11, 2006, 07:36:29 am
I will create every weekend such a Win9x ansi build.
For the nightly I first want to automate a little bit more, since now I need to manually change and merge the cbp files. Will write a little proggie for it.
Title: Re: WIN98/9x/others build : registry settings test
Post by: takeshimiya on January 11, 2006, 05:52:53 pm
Why don't you create a Win9x compatible unicode build?

I've been build from SVN that way from some months ago.
If you need more help feel free to ask.
Title: Re: WIN98/9x/others build : registry settings test
Post by: takeshimiya on January 11, 2006, 06:00:16 pm
I've created a batch file to automate the task, if you find it useful feel free to use it:

create-distrib.bat
Code
@echo off

REM This batch requieres the following Windows free software:
REM * A Code::Blocks capable of building latest SVN HEAD
REM * TortoiseSVN
REM * 7-zip

setlocal
set CB_HEAD_PATH=D:\Develop\src\codeblocks-head\codeblocks-svn
set SEVENZIP_PATH=C:\Archivos de programa\7-Zip
set TORTOISESVN_PATH=C:\Archivos de programa\TortoiseSVN\bin
set CURRENT_PATH=%CD%

echo Checking the latest revision before updating...
echo $WCREV$ > rev-before-update.log
"%TORTOISESVN_PATH%\SubWCRev.exe" "%CB_HEAD_PATH%" "%CURRENT_PATH%\rev-before-update.log" "%CURRENT_PATH%\rev-before-update.log"
if not errorlevel 0 goto FAILED

echo Running svn update...
"%TORTOISESVN_PATH%\TortoiseProc.exe" /command:update /path:"%CB_HEAD_PATH%" /notempfile /closeonend:1
if not errorlevel 0 goto FAILED


echo Checking the latest revision after updating...
echo $WCREV$ > rev-after-update.log
"%TORTOISESVN_PATH%\SubWCRev.exe" "%CB_HEAD_PATH%" "%CURRENT_PATH%\rev-after-update.log" "%CURRENT_PATH%\rev-after-update.log"
if not errorlevel 0 goto FAILED

echo Compiling Code::Blocks itself...
"%CB_HEAD_PATH%\src\output\codeblocks.exe" --build "%CB_HEAD_PATH%\src\CodeBlocks-NewBuild.cbp" > "%CURRENT_PATH%\build.log"
echo FIXME codeblocks errorlevel: %errorlevel%

echo Running update script...
cd "%CB_HEAD_PATH%\src"
call "%CB_HEAD_PATH%\src\update.bat"
if not errorlevel 0 goto FAILED

echo Compressing with 7-zip...
"%SEVENZIP_PATH%\7z.exe" a "%CURRENT_PATH%\codeblocks-svnbuild.7z" "%CB_HEAD_PATH%\src\output\*" -r -mx9 -sfx[7zC.sfx]
if not errorlevel 0 goto FAILED




echo The build has completed.
goto END
:FAILED
echo The build has failed.

:END
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 11, 2006, 07:05:29 pm
thanks,
I already had nearly something like that ready.
But a build like this is not usable yet on win9x, you need the unicows stuff, and there might be legal problems with that one (see some other threads I started about win98 etc ...)!!!

But will continue to work on it though.
Lieven
Title: Re: WIN98/9x/others build : registry settings test
Post by: takeshimiya on January 11, 2006, 07:25:44 pm
libunicows is perfectly legal (both the MSLU one of microsoft and the opensource one), it only loads at runtime, either the dependency of microsoft (unicows.dll), or the opensource reverse enginered by mozilla (opencow.dll). Wich both are perfectly legal also.

The only time it will be illegal if is you distribute unicows.dll by microsoft without the redist package (ie. you put the dll directly). Anyways a lot of programs use it in Win9x so chances are that it will be installed beforehand.

You know the app poEdit? It's for translating gettext catalogues. The program is written in wxWidgets, and it's distributed in Unicode with libunicows. It works in any Windows. Imagine if you have Win9x and wants to do translations without unicode, it's a pain.

For more details see http://libunicows.sourceforge.net/

Appart, it's a lot better to link with libunicows instead of MSLU directly, because you don't have to include the entire platform sdk and those kind of things.

Here's all you need in a DevPak: http://devpaks.org/details.php?devpak=82
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 11, 2006, 07:28:15 pm
now we need to convince Thomas and Yiannis ;-)

would be nice to have one uild that serves all windows (no no not 3.11)
Title: Re: WIN98/9x/others build : registry settings test
Post by: takeshimiya on January 11, 2006, 07:31:05 pm
Well, first make an Unicode build linked with unicows, so a few users of Win9x can test it. :)

Be sure to check that your setup.h haves wxUSE_UNICODE_MSLU = 1.
Quote
Hello,

version 0.5 of libunicows, a compiler-independent open source
implementation of MSLU import library, was released and is available
for download from http://libunicows.sourceforge.net. Precompiled
binaries for Visual C++ and Mingw32 are included (help with other
compilers is wanted).

MSLU (The Microsoft Layer for Unicode on Windows 95/98/ME Systems) is
a compatibility layer that makes it possible to run Unicode
applications on Windows 9x systems (previously, Unicode APIs were
only available on Windows NT/2000; see
http://www.microsoft.com/globaldev/Articles/mslu_announce.asp for
details). Necessary runtime DLLs can be downloaded from
http://www.microsoft.com/downloads/release.asp?releaseid=30039

MSLU requires that you use a special statically-linked import library
that is currently only provided for Microsoft Visual C++ and only as
a part of the (rather large) new Platform SDK. Libunicows addresses
both of these problems by being small and available in source code
form.

wxWindows 2.3 contains MSLU support and works with libunicows (VC++
makefile and configure-generated makefile for Mingw32 can both use
it). Libunicows is used in two wxWindows projects: poEdit
(http://poedit.sf.net) and Unicode build of wxPython
(http://wxpython.org).

Best regards,
Vaclav Slavik
Title: Re: WIN98/9x/others build : registry settings test
Post by: duncanka on January 19, 2006, 05:51:54 am
Well, first make an Unicode build linked with unicows, so a few users of Win9x can test it. :)

Be sure to check that your setup.h haves wxUSE_UNICODE_MSLU = 1.
I just tried this for myself, building from the latest SVN (1804), and it was kind of a disaster.  I built wxWidgets the usual way, with the exception that I enabled MSLU support, and linked CB against it.  When I ran the program, it did load up properly (though for some reason, I had to specify the program's own directory using the --prefix option for this to work).  But the program I got was very crippled.  For one thing, I cannot see the editor.  It just doesn't appear when I open a file, even though the title bar and the status bar both indicate an open file.  Additionally, dragging a dockable pane invariably results in an immediate crash.  A stack trace always reveals Opencow.dll at the end of the trace, or Unicows.dll if I use the Microsoft implementation, though I have no idea if this means MSLU is at fault.
(I've attached a copy of Dr. Mingw's error report from the wxAUI pane-dragging crash.)
Where did I go wrong??!  :( :?  Help, anyone??

[attachment deleted by admin]
Title: Re: WIN98/9x/others build : registry settings test
Post by: takeshimiya on January 19, 2006, 06:10:41 am
On what OS are you testing?
Title: Re: WIN98/9x/others build : registry settings test
Post by: mandrav on January 19, 2006, 08:41:35 am
Quote
But the program I got was very crippled.  For one thing, I cannot see the editor.  It just doesn't appear when I open a file, even though the title bar and the status bar both indicate an open file.  Additionally, dragging a dockable pane invariably results in an immediate crash.

Whenever you see layout-related errors, try deleting your active layout (or switch to another one if you have).
"View->Layouts->Delete current".
Title: Re: WIN98/9x/others build : registry settings test
Post by: duncanka on January 19, 2006, 10:16:52 pm
On what OS are you testing?
Sorry, should've mentioned that...I'm using Windows 98SE.

Quote
But the program I got was very crippled.  For one thing, I cannot see the editor.  It just doesn't appear when I open a file, even though the title bar and the status bar both indicate an open file.  Additionally, dragging a dockable pane invariably results in an immediate crash.

Whenever you see layout-related errors, try deleting your active layout (or switch to another one if you have).
"View->Layouts->Delete current".
I tried this, and it helped for a short time.  The "Start here" page appeared when I reverted to the built-in default layout, and I could open files in the editor.  But I still keep getting a lot of random crashes, and the "Start here" page doesn't always go away when I open a project.  At least it's more or less usable, though.  Still, I think I may just stick with my old ANSI SVN version (the one posted earlier in this thred).  For some reason, the MSLU-enabled compilation just seems too unstable.
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 19, 2006, 10:25:51 pm
this weekend I will create a new specific ansi build !!
Title: Re: WIN98/9x/others build : registry settings test
Post by: duncanka on January 20, 2006, 12:37:09 am
this weekend I will create a new specific ansi build !!
:D :D
Is there anything special involved, other than just changing the unicode suffix and removing the unicode #define?
Title: Re: WIN98/9x/others build : registry settings test
Post by: tiwag on January 20, 2006, 12:39:09 am
Is there anything special involved, other than just changing the unicode suffix and removing the unicode #define?
you need a wxWidgets ansi build  :)
Title: Re: WIN98/9x/others build : registry settings test
Post by: duncanka on January 20, 2006, 12:44:13 am
Is there anything special involved, other than just changing the unicode suffix and removing the unicode #define?
you need a wxWidgets ansi build  :)
Right, obviously.  8)  I meant from the C::B end of things.
Title: Re: WIN98/9x/others build : registry settings test
Post by: tiwag on January 20, 2006, 12:51:01 am
Is there anything special involved, other than just changing the unicode suffix and removing the unicode #define?
you need a wxWidgets ansi build  :)
Right, obviously.  8)  I meant from the C::B end of things.
i meant, "no nothing" just the wxwidgets ansi build in addition to your suggestion
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 20, 2006, 07:30:04 am
no you need nothing else, but if you build it yourself, you need to add to the sdk target 2 more libs.

@Yiannis : could you always add them to the target ? Then for win98 this is already ok, only need to turn off then unicode define/suffix then.
Title: Re: WIN98/9x/others build : registry settings test
Post by: mandrav on January 20, 2006, 08:56:44 am
@Yiannis : could you always add them to the target ? Then for win98 this is already ok, only need to turn off then unicode define/suffix then.

What libs?
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 20, 2006, 09:15:30 am
for the sdk target :
libshfolder.a
libshell32.a


The first one for sure, the second one probably.

Title: Re: WIN98/9x/others build : registry settings test
Post by: mandrav on January 20, 2006, 09:37:25 am
for the sdk target :
libshfolder.a
libshell32.a

Are you sure these should go in the sdk target? I think it should be the src target (main app), although I might be wrong. Can you confirm this?
Title: Re: WIN98/9x/others build : registry settings test
Post by: killerbot on January 20, 2006, 09:46:26 am
Yiannis,

I can't confirm or 'dis'confirm :-(
I also got his information from ceniza and therion.
I think they got to this by trial and error with some win98 users.
I could never test myself, since I don't have win98 anymore.

Lieven

[EDIT] : one thing is for sure, when they were added to the sdk target, things worked.
Well, you have the best insght, if you think they need to be added to the main, please do. This weekend I will make a new ansi build, so the win98 users will be able to give feedback on it, so then we will know for sure.
Title: Re: WIN98/9x/others build : registry settings test
Post by: mandrav on January 20, 2006, 09:57:02 am
I can't confirm or 'dis'confirm :-(

OK, added it in the src target 'cause that's where it should be IMHO. If this doesn't work, it's still easy to move them in the sdk target ;)

r1822.
Title: Re: WIN98/9x/others build : registry settings test
Post by: duncanka on January 23, 2006, 03:14:29 am
I can't confirm or 'dis'confirm :-(

OK, added it in the src target 'cause that's where it should be IMHO. If this doesn't work, it's still easy to move them in the sdk target ;)

r1822.
I just compiled rev1836 on Win98SE.  With shfolder linked into the src target, I got an error about codeblocks.dll using an undefined function.  When I linked shfolder into the sdk target instead, it worked fine.  It appears Lieven was right about Therion's and Ceniza's conclusions.
Note, by the way, that at least in the sdk target, I didn't need shell32 to be linked.