From: bluestar on
I have a mfc project and run successfully on x32 platform, but it
can't work on x64 platform.
In my project, i would use below functions to work.

//Find Device
SetupDiGetClassDevs$B!"(BSetupDiEnumDeviceInterfaces$B!"(BSetupDiGetDeviceInterfaceDetail
CM_Locate_DevNode$B!"(BCM_Get_Child$B!"(BCM_Get_Device_ID

//CopyFile to windows directory
SHGetFolderPath$B!"(BCopyFile

//AddServiceKey
RegOpenKeyEx$B!"(BRegCreateKeyEx$B!"(BRegSetValueEx$B!"(BRegCloseKey

Which one can't work on x64 platform?
And how to modify registers that mapping x32 and x64 platform?
like, below set to open register on x32 platform, but how to work on
x64 platform?
RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\
\Services"), 0, KEY_ALL_ACCESS, &hKey);

Thanks for your kindly help!!!
From: Joseph M. Newcomer on
See below...

On Thu, 24 Apr 2008 22:40:55 -0700 (PDT), bluestar <bluestar8783(a)gmail.com> wrote:

>I have a mfc project and run successfully on x32 platform, but it
>can't work on x64 platform.
>In my project, i would use below functions to work.
>
>//Find Device
>SetupDiGetClassDevs?SetupDiEnumDeviceInterfaces?SetupDiGetDeviceInterfaceDetail
>CM_Locate_DevNode?CM_Get_Child?CM_Get_Device_ID
>
>//CopyFile to windows directory
>SHGetFolderPath?CopyFile
****
You should not be touching the Windows directory; the fact that works at all in 32-bit
shows you are using in on machines whose security is irredeemably slovenly; you would not
be able to do this on any of my machines, for example. Why do you think you need to touch
the Windows directory?
****
>
>//AddServiceKey
>RegOpenKeyEx?RegCreateKeyEx?RegSetValueEx?RegCloseKey
****
See the comment below. You should not be doing this sequence to add a service key; you
should be calling the Service Control Manager!
****
>
>Which one can't work on x64 platform?
>And how to modify registers that mapping x32 and x64 platform?
****
I don't understand this question. What registers?
****
>like, below set to open register on x32 platform, but how to work on
>x64 platform?
>RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\
>\Services"), 0, KEY_ALL_ACCESS, &hKey);
****
Generally, it is considered a Really Bad Idea to modify HKLM except at install time. In
particular, SYSTEM\CurrentControlSet\Services should be locked down so tight that you
should not be able to modify it (I would not trust the sysadmin who allowed it to be
writeable). Why do you need to modify this key? (Typically, this is used to specify
services, and the SCM should handle that for you!)

This code would fail on any of my machines, and would have failed for several years.
Again, only slovenly security would allow this key to be modified at all. Consider it the
most gratuitous accident that this code has EVER worked.
joe
****
>
>Thanks for your kindly help!!!
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: bluestar on
> Generally, it is considered a Really Bad Idea to modify HKLM except at install time.  In
> particular, SYSTEM\CurrentControlSet\Services should be locked down so tight that you
> should not be able to modify it (I would not trust the sysadmin who allowed it to be
> writeable).  Why do you need to modify this key?  (Typically, this is used to specify
> services, and the SCM should handle that for you!)
>
> This code would fail on any of my machines, and would have failed for several years.
> Again, only slovenly security would allow this key to be modified at all.  Consider it the
> most gratuitous accident that this code has EVER worked.
>                                         joe
> ****
>
> >Thanks for your kindly help!!!
>
> Joseph M. Newcomer [MVP]
> email: newco...(a)flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm

Dear sir:

Thanks for your kindly suggestion.

My co-worker coded this program that add/remove
filter driver into register and let it run before.
He copy *.sys into C:\Windows\System32\Drivers
, add register values into HKLM\SYSTEM\CurrentControlSet
\Services
and then restart device to let driver work.

It works successfully on x32 platform, but fail to work x64
platform
I want to modify this program to run on x64 platform.
I think it will differ from both platform registers.

Could you tell me if i want to modify program and let program
work the same as x32 when it runs on x64?

Thanks for your great help.
From: bluestar on
On 4$B7n(B28$BF|(B, $B>e8a(B10$B;~(B51$BJ,(B, bluestar <bluestar8...(a)gmail.com> wrote:
> > Generally, it is considered a Really Bad Idea to modify HKLM except at install time. In
> > particular, SYSTEM\CurrentControlSet\Services should be locked down so tight that you
> > should not be able to modify it (I would not trust the sysadmin who allowed it to be
> > writeable). Why do you need to modify this key? (Typically, this is used to specify
> > services, and the SCM should handle that for you!)
>
> > This code would fail on any of my machines, and would have failed for several years.
> > Again, only slovenly security would allow this key to be modified at all. Consider it the
> > most gratuitous accident that this code has EVER worked.
> > joe
> > ****
>
> > >Thanks for your kindly help!!!
>
> > Joseph M. Newcomer [MVP]
> > email: newco...(a)flounder.com
> > Web:http://www.flounder.com
> > MVP Tips:http://www.flounder.com/mvp_tips.htm
>
> Dear sir:
>
> Thanks for your kindly suggestion.
>
> My co-worker coded this program that add/remove
> filter driver into register and let it run before.
> He copy *.sys into C:\Windows\System32\Drivers
> , add register values into HKLM\SYSTEM\CurrentControlSet
> \Services
> and then restart device to let driver work.
>
> It works successfully on x32 platform, but fail to work x64
> platform
> I want to modify this program to run on x64 platform.
> I think it will differ from both platform registers.
>
> Could you tell me if i want to modify program and let program
> work the same as x32 when it runs on x64?
>
> Thanks for your great help.- $Bp,i6Ho0zMQJ8;z(B -
>
> - $Bp}<(Ho0zMQJ8;z(B -

I will found it add the same places on x64 platform, but it can't work
(Devices Management don't see the filter is not loaded on)
Why? and How to modify it to run successfully?
From: Joseph M. Newcomer on
See below...
On Sun, 27 Apr 2008 19:51:51 -0700 (PDT), bluestar <bluestar8783(a)gmail.com> wrote:

>> Generally, it is considered a Really Bad Idea to modify HKLM except at install time. �In
>> particular, SYSTEM\CurrentControlSet\Services should be locked down so tight that you
>> should not be able to modify it (I would not trust the sysadmin who allowed it to be
>> writeable). �Why do you need to modify this key? �(Typically, this is used to specify
>> services, and the SCM should handle that for you!)
>>
>> This code would fail on any of my machines, and would have failed for several years.
>> Again, only slovenly security would allow this key to be modified at all. �Consider it the
>> most gratuitous accident that this code has EVER worked.
>> � � � � � � � � � � � � � � � � � � � � joe
>> ****
>>
>> >Thanks for your kindly help!!!
>>
>> Joseph M. Newcomer [MVP]
>> email: newco...(a)flounder.com
>> Web:http://www.flounder.com
>> MVP Tips:http://www.flounder.com/mvp_tips.htm
>
>Dear sir:
>
> Thanks for your kindly suggestion.
>
> My co-worker coded this program that add/remove
> filter driver into register and let it run before.
****
This is a Really Bad Idea; it worked only with legacy drivers and should not work at all
for a Plug-and-Play driver; if it does, it is (a) unsupported and can break at any time
(b) amazing
****
> He copy *.sys into C:\Windows\System32\Drivers
****
This should only be possible for someone logged on with Administrator privleges, and as
such, should not be used on any real computer.
****
> , add register values into HKLM\SYSTEM\CurrentControlSet
>\Services
> and then restart device to let driver work.
****
I find the whole concept terrifying.
****
>
> It works successfully on x32 platform, but fail to work x64
>platform
****
What OS? XP64 or Vista64? Windows Workstation or Windows Server? You have not given
anything like enough information.

The driver has to be a 64-bit driver; if it is not compiled as a 64-bit driver it cannot
possibly work, ever, under any conditions.

So if it IS a 64-bit driver, refer to (a) above. For example, this technique could not
possibly work on Vista64, and I would personally consider any attempt to do this to be an
attack on the machine.
****
> I want to modify this program to run on x64 platform.
****
First, you have to compile the device driver with a 64-bit build for the platform in
question, which is undefined
****
> I think it will differ from both platform registers.
****
I am amazed it ever worked. I would not at all be suprised if it finally became a victim
of improved security.
****
>
> Could you tell me if i want to modify program and let program
> work the same as x32 when it runs on x64?
****
What program? The "installer" or the device driver? Note that at no point have you
defined what you mean by "fail"! How do you think it is possible to answer a question of
the form "my program doesn't work" unless we know
What version of Windows you are using?
Are all the service packs and hot fixes installed?
Are you using a 64-bit driver?
Are you logged in with Administrator privileges?
What security is set on the Registry?
What security is set on the Windows, System32 and Drivers directories?

Overall, the whole concept seems more like a kludge that has finally met its match rather
than something that should have been expected to work at all. You should refer questions
like this to a driver newsgroup.
joe
****
>
> Thanks for your great help.
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm