windows7 – Ticklish Techs https://www.ticklishtechs.net a mostly .NET but also some other cool techs blog Thu, 13 Aug 2020 18:46:34 +0000 en-US hourly 1 https://wordpress.org/?v=5.7.11 Foxit Reader vs. Acrobat Reader: the default program problem https://www.ticklishtechs.net/2010/02/07/foxit-reader-vs-acrobat-reader-the-default-program-problem/ Sun, 07 Feb 2010 11:52:12 +0000 http://www.ticklishtechs.net/2010/02/07/foxit-reader-vs-acrobat-reader-the-default-program-problem/ I’m a big fan of the Foxit pdf Reader. It is just so damn fast in comparison to Acrobat Reader when opening pdf documents. Yesterday I had to go through a bunch of pdfs each containing only one or two pages to find a specific one. While waiting for Acrobat Reader to open a file I could open, check an close a few files with Foxit. If you are not using Foxit Reader give it a try…

But for some pdf features you will need the original Adobe Reader. E.g. some documents with fields to enter data, with scripts or DRM secured files won’t open in Foxit.

I always have both installed on my machine and Foxit is the default application for opening pdf documents. But this setting changed some time ago on my Windows 7 64 bit machine.

I reset the default program for pdf in windows control panel to Foxit and all icons of pdf documents changed to the Foxit one. I can double click a file and Foxit opens  – great. But in the very moment Foxit comes up the default program is set to Acrobat Reader again. This happens all the time.

I’m not sure what’s going on here and what is involved. I was blaming Acrobat and searched for a solution on the Acrobat side of the problem. Nothing.

In the end an update of Foxit to the current version fixes my problems.

]]>
Don’t respect .inf-files too much https://www.ticklishtechs.net/2010/01/19/dont-respect-inf-files-too-much/ Mon, 18 Jan 2010 23:50:55 +0000 http://www.ticklishtechs.net/2010/01/19/dont-respect-inf-files-too-much/ When I get a new laptop that always triggers a little cascade in my home network. I have three machines: An older laptop serves as a server, a quadcore desktop pc provides gaming power and the a newer laptop accompanies me wherever I go.

Some day ago I replaced the old server laptop (with WinXP) by a newer one, now running Win7.  My printer (Brother DCP-120C) is a little aged now and it’s not a network printer. So I attached it to the server (via USB) and thus it’s accessible in the entire network.

Attaching the printer to Win7 worked flawlessly. Importing the printer (which involves copying the drivers) to another Win7-machine was not a problem either.

But my quadcore still runs WinXP and wouldn’t accept the drivers from the Win7-server. Instead a dialog asks me to provide the appropriate driver manually.

Okay, so I downloaded the latest DCP-120C-drivers for WinXP, unzipped them and guided XP to the .inf-files. XP said: “No, I can’t see the right drivers.”

Unfortunately there is no way to force WinXP to use certain printer-drivers. So I spend ten minutes playing the old yes-no-game before I took a look at the .inf-file. I have never dealt with .inf-files a lot but I noticed this line:


"Brother DCP-120C Printer"   = BRDP120C.PPD, BrotherDCP-120C65FA

Hmm… okay… it is there. My Brother DCP-120C Printer. Fine. Why doesn’t WinXP recognize it? I found another .inf-file in the driver-package with these line:


"Brother DCP-120C USB Printer"   = BRDP120C.PPD…

Hmm… now the name is DCP-120C USB Printer. Do the funny name string make any dfference? I took a closer look at the printer device that was recognized by my server:

image

Okay, nice, there is no “Printer” in the name… can it be… well… I copied the line in the .inf-file and replaced “Printer” by “USB”:

"Brother DCP-120C Printer"   = BRDP120C.PPD, BrotherDCP-120C65FA
"Brother DCP-120C USB"   = BRDP120C.PPD, BrotherDCP-120C65FA

Bingo! That did the trick.

When accessing printers installed on other network computers, the printer drivers really seem to be recognized by their name. That hurts a bit, but knowing it may help solving driver problem from time to time.

]]>
Acronis True Image Home 2010 hangs with Windows 7 https://www.ticklishtechs.net/2010/01/19/acronis-true-image-home-2010-hangs-with-windows-7/ Mon, 18 Jan 2010 22:17:32 +0000 http://www.ticklishtechs.net/2010/01/19/acronis-true-image-home-2010-hangs-with-windows-7/ I am a great fan of Acronis True Image. I am using it for a long time and it has saved my skin more than once. So I was glad to hear that the new version (True Image 2010) was designed to work with Win 7. And so it did.

Last week I got a new laptop and today I tried to backup my fresh installation ov Win7/64. Each time True Image caused my entire system to freeze after five seconds of backing up. No reaction at all, the only way out way a hard button-press reset. I tried different options without results. (Which made me panic, because on what else can you rely when not on your backup tool?) –

Fortunately I found the solution here.

There is a new driver for hdd-image snapshots. Installed it, True Image 2010 works again.

Phew!

]]>
Shell-Lib reloaded: Another OS, another bug. https://www.ticklishtechs.net/2010/01/10/shell-lib-reloaded-another-os-another-bug/ Sun, 10 Jan 2010 14:38:06 +0000 http://www.ticklishtechs.net/2010/01/10/shell-lib-reloaded-another-os-another-bug/ Some time ago we blogged about a nifty little .net assembly that enables you to access the basic Windows shell operations in shell32.dll . You may want to do so especially in Win7 because your file operations integrate with the fancy Win7 dialogs, the flashing progress bar etc.

The problem we blogged about in the former post was a missing "Pack"-instruction in the marshalling-description of a structure. I guess we didn’t test it with WinXP64… but some days ago we tests it with Win7/64 and it failed. We figured out that we introduced a new bug that occurred on 64 bit machines only. After some more testing we found out that:

  • The original code (without Pack-value) crashes on 32 bit machines (as described in the former post).
  • The original code (without Pack-value) works fine on 64 bit machines (but we don’t think the original developer had 64 bits 7 years ago 😉 ).
  • Our fixed code (with Pack=2) works fine on 32 bit machines.
  • Our fixed code (with Pack=2) crashes on 64 bit machines.

It seems that the "SHFILEOPSTRUCT" structure in shell32.dll has different layouts in Win7/64 and Win7/32. I guess the guys at MS aim for performance and tell the compiler to optimize. The compiler optimizes by assuming the optimal Pack-value, which usually is the byte-width of the processor; 4 for 32bit, 8 for 64bit.

What effect does the Pack-value have at all?

The "Pack"-value controls the alignment of the starting addresses of each single member of a structure (often called "offset").

Let’s say you have this struct:

struct MammaMia
{
    public int16 sweet16;
    public byte bite;
    public string tanga;
}

Usually you don’t care for the exact way your data is stored in memory, but when you pass it from .NET to the Win-API you have to make sure Win-API receives and returns exactly the right format. This process is called "Marshalling".

One crucial instruction for doing so is the StructLayout attribute.

[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct MammaMia
{
    public int16 sweet16;
    public byte bite;
    public string tanga;
}

(Note: There are a lot more options for the StructLayout attribute and a lot more attributes that help you at marshalling.)

LayoutKind.Sequential means that your data is represented in memory in the same order as you declared it: First "sweet16", than "bite" and then "tanga".

Pack=1 tells .NET that every byte can be the starting point of the next member. So .NET produces this structure in memory:

Pack=1  
byte data
0 sweet16
1 sweet16
2 bite
3 tanga
4 tanga
20 last character of tanga

 

 

Now Pack=2 makes sure that only every 2nd byte can be the starting point of the next member. That leads – of course – to unused bytes in memory:

Pack=2  
byte data
0 sweet16
1 sweet16
2 bite
3 ??? (unused)
4 tanga
5 tanga
21 last character of tanga

 

 

The higher the Pack-value, the more unused bytes you get:

Pack=4  
byte data
0 sweet16
1 sweet16
2 ??? (unused)
3 ??? (unused)
4 bite
5 ??? (unused)
6 ??? (unused)
7 ??? (unused)
8 tanga
9 tanga
25 last character of tanga

 

Is this a waste of memory? Sure. But processors can access those addresses a bit faster than other addresses. So it’s an performance/memory tradeoff.

After some more testing, I figured out that the correct Pack-value for Win7/64 is 8, while the correct Pack-value for Win7/32 is 2 (see former post). Why 2? I’d expect 4 here. I don’t know and Microsoft wouldn’t provide the source code I guess.
Maybe in former Windows version they preferred a middle-course between performance and saving memory.

The simple solution

Now it was obvious how to make die ShellLib-assembly work with 32 and 64bit: Check what machine we run on and use a different marshalling. Since I had to declare different structs here, the major code is copying data back and forth, not very interesting.

The only interesting part here is: How do you check on what kind of machine you run? I was looking for some property at System.Environment, but didn’t find anything. Then Andreas pointed me to this post and the solution is too simple to cross one’s mind:

“Just do a IntPtr.Size (static method) and since IntPtr is designed to be an integer whose size is platform specific, it will be 8 if you are on a 64-bit machine and 4 if you are on a 32-bit machine.“

You can find more information and our fixed code soon at the codeproject.com .

Epilog

You can also do the marshalling all by yourself, starting with memory allocation and ending with freeing memory, just like in the old times. But this is another story and will be told later.

Maybe.

]]>
Lenovo Integrated Camera again working on Windows 7 https://www.ticklishtechs.net/2010/01/01/lenovo-integrated-camera-again-working-on-windows-7/ https://www.ticklishtechs.net/2010/01/01/lenovo-integrated-camera-again-working-on-windows-7/#comments Fri, 01 Jan 2010 11:56:09 +0000 http://www.ticklishtechs.net/2010/01/01/lenovo-integrated-camera-again-working-on-windows-7/ My Lenovo X200 notebook comes with an integrated webcam and I’m using it pretty often for Skype calls etc. But some time ago it stopped working. After reinstalling drivers, taking to the Lenovo support hotline, installing exactly the driver I was told to it was still broken. Yesterday a Lenovo technician cam to replace the camera (I’m so glad to have on-site support and do not need to send the notebook in), but in the end the new webcam behaves exactly as the first one – just not working.

So I started to debug the problem by myself and figured the following out. Maybe this is just an issue on my machine with my other software installed but maybe this is helpful for someone else.

The driver from the Lenovo webpage is build by the camera vendor Ricoh. That driver package just does not work on my Windows 7 64bit machine. The out-of-the-box Windows 7 driver works just fine!

Find the Camera device in Device Manager

device manager

On the properties sheet choose Update driver

Integrated Camera Properties

Then “Browse my computer for driver software” and  “Let me pick from a list of device drivers on my computer”

Update Driver Software I

Update Driver Software II

On my machine it only shows up one compatible “USB Video Device” – just use that driver:

Update Driver Software III

If Windows does not find this single one you can select it from the larger list by unchecking “Show compatible hardware” and choosing “Microsoft” / “USB Video Device”:

Update Driver Software VI

For some reason it does not always work the moment I installed the new driver and I had to reboot the machine. After installing the driver the device in device manager is called “USB Video Device” but after the reboot it is for some reason renamed to “Integrated Camera” but still using the Windows driver (that is the important part, you can check it in the properties sheet from within device manager). From now on it was working fine.

After some time Windows suddenly replaced this driver with the Ricoh one and the camera was broken again. To prevent Windows from doing so I uninstalled the driver package from “Programs and Features” in Control Panel.

]]>
https://www.ticklishtechs.net/2010/01/01/lenovo-integrated-camera-again-working-on-windows-7/feed/ 24
Upgrading Windows 7 RC to RTM https://www.ticklishtechs.net/2009/08/02/upgrading-windows-7-rc-to-rtm/ https://www.ticklishtechs.net/2009/08/02/upgrading-windows-7-rc-to-rtm/#comments Sun, 02 Aug 2009 08:04:10 +0000 http://www.ticklishtechs.net/2009/08/02/upgrading-windows-7-rc-to-rtm/ Disclaimer: The following is no official advice or anything. I just did it and it worked ON MY MACHINE. Fell free to try but have a backup of your data.

The Windows 7 RTM bits will not allow an upgrade from an earlier version of Windows 7 (e.g. RC or beta). I belief that Microsoft did this to ensure that your new operating system works just fine and no beta and release bits get mixed up.

For the upgrade from the beta version to the release candidate quickly some patch occurred which allowed an upgrade. I used the same one and it works fine on my machine to upgrade Windows 7 RC to RTM.

What’s to do?

You need to change one file on the installation DVD. On way to do this is to copy all files to your computer, change the file and burn a new DVD. Since the upgrade will be run from within the already installed Windows 7 you do not need to boot from this DVD. I just copied all files to a USB drive and run the setup.exe from that drive. I belief you will be able to install Windows also from a directory on you local hard disk containing all the files from the DVD.

In the source folder you will find a text file named cversion.ini. The original file looks like:

[HostBuild]
MinClient=7233.0
MinServer=7100.0

Just change the MinClient number to the build version of you current Windows version. For the Windows 7 RC it will be 7100.

The upgrade should work fine now. But if your new Windows 7 starts acting strange don’t blame Microsoft or me. Always remember you installed it with an unsupported patch.

]]>
https://www.ticklishtechs.net/2009/08/02/upgrading-windows-7-rc-to-rtm/feed/ 2