July 2005 - Posts

It's reported over here how to get it to work: http://www.extended64.com/blogs/rafael/archive/2005/07/30/1088.aspx. So if you want youcan try it (not supported of course on this OS, but it works). However, when clicking the View menu I get an error message as follows:

The procedure entry point InternetGetSecurityInfoByURLW could not be located in the dynamic link library WININET.DLL

both triggered by the SQL Server Service Manager (sqlmangr.exe) and Windows Desktop Search (WindowsSearch.exe). This function serves other apps to obtain security information based on a URL (see internet zones functionality in the browser) and seems to have some issue now with IE7. Using dumpbin.exe I found out that the new dll (version 7.0.5112.0) has this function

        260   8E 0003CD48 InternetGetSecurityInfoByURLW

whileas the old one (version 6.0.3790.1830 living in system32) hasn't this function. I don't have an exact idea where this comes from yet, but maybe it has to do with the menu option "Security Report" that's grayed out in my View menu. Just a little thought of mine though.

Btw, this blog entry was posted running IE 7 on Windows Server 2003 x86 :-).

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Download completed, installation started. Keep tracking my blog for more information about my first experiences with Longhorn Server Beta 1 very soon.Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

It has always been a fascinating aspect of mine, the art of automatic memory management. By going through the CLR Hosting APIs I was reminded of this again. I'll continue my exploration experience blog post series on CLR Hosting very soon, but I'm facing a bit of a heavy weekend so it will have a little delay.

In this post, I'm pointing you to a series of interesting resources about garbage collection that I've explored so far. I'll crawl through these in far much more detail in the near future, side-by-side with the CLI's GC code implementation, and will blog about it if I find the time:

Enjoy!

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Avalon, Indigo and other Vista subsystems have been renamed to marketing-shaped flashy names :-). More information on Dave Glover's blog.Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Windows Vista uses a new boot loader to display the different OSes that are installed on your computer. After installing the Windows Vista OS in parallel with another OS, you'll get two menus. In the first you can choose to launch Windows Vista or to launch "some legacy operating system". When you choose the latter one, the old familiar boot menu is displayed. However, you can control this behavior by editing boot.ini manually:

[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows Longhorn" /FASTDETECT /NOEXECUTE=OPTIN /USENEWLOADER
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /FASTDETECT /NOEXECUTE=OPTIN

This is how my boot.ini file looked like immediately after the installation of Vista Beta 1. As the matter in fact, the new boot loader menu shows all of the entries that have the /USENEWLOADER switch. All other entries are accessible through the "legacy operating systems" menu option. So, I modified the file as follows

[boot loader]
timeout=5
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINDOWS="Microsoft Windows Longhorn" /FASTDETECT /NOEXECUTE=OPTIN /USENEWLOADER
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /FASTDETECT /NOEXECUTE=OPTIN /USENEWLOADER

Which is causing XP to be the default again (it's my second box also shared with other family members), setting the timeout to 5 seconds and sending the old boot loader menu off to early retirement :-). Much better now.

Update: I experienced a problem today, which I didn't had yesterday as far as I know :s (but it should have been there if the Windows loading process is still deterministic, lol :d). When trying to load Windows XP through the new loader, it stops with the error message it can't find winloader.exe in the system folder. So, I'd recommend to drop this trick for now (I'll try to find out more details about compatibility of loaders with older OSes), but changing the default to XP still is a good idea as in that case the timeout works very well (after twice 5 seconds the system starts Windows XP, twice because both the new and old menu use this timeout value). I'm starting the installation of Longhorn Server Beta 1 right now on the same box and will post about my experiences and boot load stuff with that OS later on.

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

For those of you who are part of the Windows Vista Beta 1 program, here are some setup instructions if you want to give Vista a first try on Virtual PC 2004. I assume you do have the .iso file (2.42 GB in size), e.g. from the MSDN Subscribers website.

  1. Download and unzip the VCD ISO tool to mount the .iso file to a drive letter on the host operating system. Read the readme.txt file for instructions on how to use it. Assume the mounted drive letter is Z:.
  2. Start Virtual PC 2004 and create a new virtual machine with a new virtual harddisk. I'm creating a virtual machine with 512 MB of RAM and a harddisk (dynamically expanding) of 120 GB (converted 122880 MB).
  3. Now launch your virtual machine and choose CD, Use Physical Drive Z:. The reason for this hook in step 1 and 3 is the fact that Virtual PC didn't accept the iso over here (likely because it's too large).
  4. After the BIOS' POST phase, you should see the Longhorn PE coming up (mini version on Windows Vista core to execute the setup in). PE stands for Preinstallation Environment.
  5. Click through the setup till you reach the page where the installation partition can be chosen (pass through the product key entry, EULA accept and installation type choice). You'll see the following message: The partition you selected is not available for installation. Please reboot your computer and verify that the disk is enabled in your computer's BIOS settings. You can click next and the disk is marked as "Unavailable". Perform the following steps:
    1. Click 'New' to create a new partition on the virtual harddisk. Choose the maximum size available (that's the full disk space). (Alternatively use diskpart through step 5.2, see below).
    2. Press SHIFT-F10 to enter the command line (key combination available in Windows setups since Windows 2000 if I'm not mistaken; I've used it at least on XP and 2003 before). Note: do not use the "host key" SHIFT key (typically the right-hand size one).
    3. Execute format c: /fs:ntfs /q to perform a quick NTFS format of the volume. Note: for the ':' symbol, use ALT-58 if you don't have the right keyboard layout; use ALT-47 for the '/' symbol.
    4. Reboot the machine (try the shutdown /r command or do a hard reset).
    5. Possibly you can receive a BSoD for ntfs.sys when launching setup again; rebooting should fix this issue. (Yes, BSoDs are still present in Vista ;-))
  6. Next time you reach the installation partition choice step, the message mentioned in the previous step should be gone and you should be able to proceed.

More information about this known problem can be found in the readme.txt file on the DVD, which can be opened in the first setup step (in Notepad).

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Update: Text in red was added as a response to Leon's feedback post concerning the recommended way of checking for .NET Framework presence on the system through registry keys. Through the updated code, you'll be able to use both mechanisms (policy key and installation key) based on precompiler directives.

Today I received an e-mail from someone who read my article on running ASP.NET apps from a CD-ROM. However, he had the following question:

Your articles describe in detail what should I do but first of all the client which "run the CD" must have the .NET Framework installed?
 
If your answer is YES as I suppose:
There is a way to check if the framework is installed on the client and if not to launch the set up of dotnetfx.exe?

Pretty good question indeed, how to detect the .NET Framework is present on the system. To do this, I wrote a little application to check the registry for the corresponding policy key (under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\policy, also used by the startup shim mscoree.dll for FX detection) in unmanaged C++ (therefore it runs on any Windows installation, regardless of .NET Framework installations). Here's the (quick-n-dirty?) code:

#define ANFP

#include
#include

/**************************************************************************************************
*
* Function to check for the presence of a given version of the .NET Framework on the machine.
*
* Parameters:
* - major version (e.g. 1)
* - minor version (e.g. 1)
* - build number (e.g. 4322)
*
* Returns:
* - 0 when not found
* - 1 when found
*
**************************************************************************************************/
int check(int major, int minor, int build)
{
   //
  
//Variables for registry functions parameter construction
  
//
   char root[1024];
#ifdef ANFP
   char bld[1024];
#endif

   //
   //Registry key
   //
   HKEY hkey;

   //
   //Registry type, value, result buffer
   //
   DWORD dwType = REG_SZ;
#ifdef ANFP
  
DWORD dwSize;
   char buffer[1024];
#endif

   //
   //Found flag
   //
   int found = FALSE;

   //
   //Registry functions parameter construction
   //
#ifdef ANFP
  
wsprintf(root, "SOFTWARE\\Microsoft\\.NETFramework\\policy\\v%d.%d", major, minor);
   wsprintf(bld, "%d", build);
#else
   wsprintf(root, "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v%d.%d.%d", major, minor, build);
#endif

   //
   //Open registry key
   //
   if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE, root, 0, KEY_QUERY_VALUE, &hkey))
   {
#ifdef ANFP
      //
      //Read registry value
      //
      if (ERROR_SUCCESS == RegQueryValueEx(hkey, bld, NULL, &dwType, (unsigned char*) &buffer, &dwSize))
         found = TRUE;
#else
      found = TRUE;
#endif

      //
      //Close registry key
      //
      RegCloseKey(hkey);
   }

   return found;
}

/**************************************************************************************************
*
* Main entry point.
*
* Parameters:
* - number of command-line arguments
* - array with command-line arguments
*
* Returns:
* - -1 on invalid syntax
* - 1 if version was found
* - 0 if version wasn't found
*
* Syntax:
*   
*
* Sample:
*    1 1 4322 managedapp.exe dotnetfx.exe
*
**************************************************************************************************/
int main(int argc, char **argv)
{
   //
   //Variables declaration for version numbers and found status
   //
   int major, minor, build, found;

   //
   //Syntax check
   //
   if (6 != argc)
   {
      printf("Bart's .NET Framework checker\n");
      printf("-----------------------------\n\n");
      printf("Usage: %s \nSample: %s 1 1 4322 managedapp.exe dotnetfx.exe\n\n", argv[0], argv[0]);
      return -1;
   }

   //
   //Version info
   //
   major = atoi(argv[1]);
   minor = atoi(argv[2]);
   build = atoi(argv[3]);

   //
   //Perform the check
   //
   found = check(major,minor,build);

   //
   //Execute actions
   //
   if (found)
      system(argv[4]);
   else
      system(argv[5]);

   //
   //Return status
   //
   return found;
}

You can download the compiled too via http://www.bartdesmet.net/download/fxcheck.exe.zip too. Update: The version that's available for download is compiled with ANFP defined. Unzip and test as follows:

C:\>fxcheck.exe 1 1 4323 "echo OK" "echo NOK"
NOK

C:\>fxcheck.exe 1 1 4322 "echo OK" "echo NOK"
OK

This should be the output on a machine with .NET v1.1 installed. Enjoy! Any comments whatsoever are welcome of course.

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

Yes, it already exists and redirects to the US Windows Vista homepage. Same for .be, .fr, .nl, .de, .co.uk. The windowsvista.ms domain however looks less cool :o.

So, to go to the official homepage of Windows Vista, take a look at www.windowsvista.be!

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

As you probably did notice it already on my blog, I'm focusing on the deeper stuff ("how things work") of various technologies such as SQL Server and the CLR for the moment (and I plan to continue to do so for the next months). Why? Well, I find it super exciting to know more about how things work. Although I have read a bunch of books on this stuff earlier, I didn't find the time to do some coding and personal research while reading these materials in the past. Now (beside of some other projects I'm involved in) I've decided to recap all of this stuff (as the Romans said: "Repetitio mater studiorum est").

For what the books are concerned, I'm crawling through:

  • Applied .NET Framework Programming (Richter)
  • The Guru's Guide to SQL Server Architecture and Internals (Henderson)
  • The Common Language Infrastructure Annotated Standard (Miller) - the bible concerning CLI stuff, but rather heavy stuff to read in bed :-)

As part of this personal commitment, I'm diving deeper in CLR implementation stuff by looking at some code too. I hope you people out there know about the existence of the Microsoft Shared Source CLI Implementation (that's the long name for a thing called "Rotor"), which is an open-source implementation (by Microsoft) of the Common Language Infrastructure, the core (standardized) functionality of the .NET Framework, including the CLR and the BCL. More information can be found on http://msdn.microsoft.com/net/sscli. This CLI implementation is targeting Windows 2000 and XP (although 2003 also works), FreeBSD 4.7 and Mac OS X 10.2.

What's included in the package?

  • A build tool to support the building process
  • Open-source implementations of the C# and JScript compilers
  • SOS debugging extension (cf. WinDbg)
  • ECMA standardization documentation
  • Technical implementation information (such as stack layout)
  • Various tools (al, sn, gacutil, ilasm, ildasm, etc) including source
  • A CLR implementation, including full source for the VM (including the GC) and the JIT engine
  • Source code of the Base Class Library (BCL)

Notice you need to use clix to run managed applications using Rotor's CLR implementation. Otherwise, the managed assembly will trigger the mscoree.dll startup shim to launch the "real" CLR on your system to execute the code. Before you can use it, you need to compile using the buildall.cmd batch that's included in the package's root directory.

In future posts I might refer to these code files to point out various aspects of the CLR's implementation (principles) when talking about CLR stuff. Currently I'm looking at some very very basic stuff in the BLC: the String class, the Int32 class, the Random class, the Guid class, the DateTime class and a first look at the GC class. I hope I'll find enough time to dive into this in much more detail, more specifically:

  • assembly loading stuff
  • assembly domains
  • code access security
  • JIT and GC

One first comment (warning) maybe, the CLR implementation (C++) code in Rotor has very little documentation inline with the code, which is a pitty.

Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

It will be released tomorrow (July 27th for clarity) according to the latest news. Just got my product key, only the ISO is still missing :-).Del.icio.us | Digg It | Technorati | Blinklist | Furl | reddit | DotNetKicks

More Posts Next page »