2

I'm having some issue with a VB program I wrote and also a setup.exe that accesses the Windows registry in a 64bit OS such as Win2k8 or Win2k3.

First Part: Issue with setup.exe and the windows registry First I'll explain the issue with the setup.exe. During install I have a custom action that fires off during the install to make a registry change to:

HKLM/Software/Microsoft/Windows NT/CurrentVersion/WinLogin/Userinit.

On 32bit OSes it works fine but on 64bit OSes it writes to:

HKLM/Software/WOW6432Node/Microsoft/Windows NT/CurrentVersion/Winlogon/Userinit

My issue here is that the logon process doesn't read from this location when a user logs in. I understand why it's accessing the 32bit part of the 64bit registry. It's because the setup.exe is a 32bit process. I can't find anywhere how I can set it to 64bit instead. Maybe all setup.exe's are 32bit, I don't know as I'm new to creating a setup program. Any idea on how to get past this issue?

Second part: issue with 64bit process accessing windows registry The second issue is when my program runs right after the user logs in. it's suppose to set a registry value that prevents the user from running the 'Task Manager' and being able to kill the app. I know it's probably a bad coding practice to circumvent Windows security but this is an internal app that I'm writing for my Company.

The code below is the function that fires to do the locking and unlocking of the task manager. On a 32bit system it works just fine, it's the 64bit one that it doesn't work in. Also have some issue when UAC is enabled. I don't want the user to be prompted to run as an administrator and not sure how to do that either. Any ideas?

Private Sub taskMgrState(ByVal state As String)
    Dim hive As String = "HKEY_CURRENT_USER\"
    Dim systemSubKey As String = "Software\Microsoft\Windows\CurrentVersion\Policies\System"
    If state = "enabled" Then
        'enable task manager use
        'create the subkey for later use
        If My.Computer.Registry.GetValue(hive & systemSubKey, "DisableTaskMgr", Nothing) Is Nothing Then
            My.Computer.Registry.LocalMachine.CreateSubKey(systemSubKey)
        End If
        'set DisableTaskMgr valuename to 0 which disables blocking the running of task manager
        My.Computer.Registry.SetValue(hive & systemSubKey, "DisableTaskMgr", 0)
    ElseIf state = "disabled" Then
        'disable the use of the task manager while this app is running
        If My.Computer.Registry.GetValue(hive & systemSubKey, "DisableTaskMgr", Nothing) Is Nothing Then
            My.Computer.Registry.LocalMachine.CreateSubKey(systemSubKey)
        End If
        'set DisableTaskMgr valuename to 0 which disables blocking the running of task manager
        My.Computer.Registry.SetValue(hive & systemSubKey, "DisableTaskMgr", 1)
    End If
End Sub
2
  • Why don't you just use Group Policies for this? Why does your program need to monkey with the registry? Jul 26, 2012 at 11:23
  • yes it does seem odd and very hackerish to do this this way but the app has to confirm some internal license information before the user can get logged in. So I am trying to prevent the logged on user from simply hitting Shift+ESC to run the task manager and kill the app or just running userinit and bypassing the apps licese checking functionality. So I don't want the taskMgr disable all the time because users may have a need to use it, I just need it disabled while the app is running.
    – todd1215
    Jul 26, 2012 at 19:02

1 Answer 1

1

To change a Setup Projects Target Platform Click On your ProjectName Deployment Project Proeprties (usually the 2nd item from the top) in the Solution Explorer then navigate to its properties tab and find the Target Platform It is automatically x86 change this to x64 You would now have to release 2 versions though. :)

2
  • Ok that makes sense. I was curious if developing on a 32bit XP machine would cause an issue running the app on 64bit OS's like Win7 2008. So now I've set both Projects the app and setup to AnyCPU, but the setup doesn't allow you to set anything for CPU type. So I'm assuming the setup.exe is always 32bit.
    – todd1215
    Jul 24, 2012 at 14:57
  • @user1243829 yes it can, sorry my bad googling led me to believe that the other steps would do the trick. I tested it myself now so the edit should do what you need Jul 24, 2012 at 18:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.