06 November, 2013

How to install .NET Framework 1.1 on Windows 8.1

After update from Windows 8.0 to Windows 8.1 I found that .NET Framework 1.1 was unexpectedly disappeared. Here I give you the tested way to return it back:

  • Download .NET Framework Cleanup Tool (product guide here) from following locations: here or here
  • Unzip and run following commands:
    cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 1.0"
    cleanup_tool.exe /q:a /c:"cleanup.exe /p .NET Framework 1.1"
  • Following instructions were taken from here:
    • Create a new folder named DotNet in C:\ drive. (The path i used was C:\DotNet)
    • Download Microsoft .NET Framework 1.1 Redistributable Package (dotnetfx.exe). Make sure the setup file is saved as dotnetfx.exe.
    • Download Microsoft .NET Framework 1.1 Service Pack 1 (NDP1.1sp1-KB867460-X86.exe). Rename the file to dotnetfxsp1.exe.
    • Copy both installation files into the same directory (i.e. C:\DotNet),.
    • Open Command Prompt as Administrator.
    • Change to the directory where the two installation files are stored, ie C:\DotNet.
    • Run the following commands one by one:
      dotnetfx.exe /c:"msiexec.exe /a netfx.msi TARGETDIR=C:\DotNet"
      dotnetfxsp1.exe /Xp:C:\DotNet\netfxsp.msp
      msiexec.exe /a c:\DotNet\netfx.msi /p c:\DotNet\netfxsp.msp
    • Install Microsoft .Net Framework 1.1 with slipstreamed Service Pack 1 by running netfx.msi from the working folder.

Good luck!

07 June, 2013

Tricky macro to add file name and line number in C++ operator new

Header file:

#if defined(_DEBUG)

  #include <crtdbg.h>

  extern __declspec(thread) char const * t_File;
  extern __declspec(thread) int t_Line;

  inline void * __CRTDECL operator new  (size_t const size) { return ::operator new  (size, _NORMAL_BLOCK, t_File, t_Line); }
  inline void * __CRTDECL operator new[](size_t const size) { return ::operator new[](size, _NORMAL_BLOCK, t_File, t_Line); }

  #define new (t_File = __FILE__, t_Line = __LINE__, false) ? nullptr : new
Source file:
#if defined(_DEBUG)
  __declspec(thread) char const * t_File = "???";
  __declspec(thread) int t_Line = 0;

This macro doesn't work with direct operator call like operator new(...) in code.

P.S. This macro tested only on Visual Studio 2012

06 June, 2013

How to enable ARM support for desktop application in Visual Studio 2012?

Just add following in your .vcxproj file, somewhere at the beginning:


P.S. Surely Windows SDK for Windows 8 has to be installed.

26 March, 2013

The important difference between ICorProfilerInfo::GetClassIDInfo() and ICorProfilerInfo2::GetClassIDInfo2() is CORPROF_E_CLASSID_IS_ARRAY. The first method never returns it.

07 March, 2013

Service environment variables

As you know service.exe generates environment variables for service every time when it starts the new service process. It merges it's own environment with ones from different places such as:

  • HKLM\System\CurrentControlSet\Control\Session Manager\Environment
  • Environment key from HKLM\SYSTEM\CurrentControlSet\Services\YourService
  • AppEnvironment key from HKLM\SYSTEM\CurrentControlSet\Services\YourService\Parameters

However, there are some not clear things with service.exe. It doesn't work correctly with REG_DWORD, but other part of Windows understand REG_DWORD correctly. So, newer write REG_DWORD values in HKLM\System\CurrentControlSet\Control\Session Manager\Environment. Please use only REG_SZ.

service.exe got it's own environment variables at the system startup and doesn't change till shutdown. So, every service in system get the mix of current environment variables and environment variables from startup. So, it's impossible to delete environment variable if it was on system startup, but it's possible to overlap the value.