2004年03月25日
《电子签章条例》今年出台 网上交易有法可依
网易科技报道 http://tech.163.com
2004-03-24 10:49:52 来源:中华工商时报 发表评论 查看评论

记者从今日在京召开的“2004信用与电子商务高峰会”上了解到,业内盼望已久的《电子签章条例》等法规有望在今年出台,易趣总裁邵亦波等十多位著名网站总裁呼吁各方协作,共同构筑诚信网络商业环境。

随着2003年电子商务行业整体回暖,网上购物的网民也在不断增加。但据国家工商行政管理总局日前公布的2003年消费者申诉举报的十大热点,网上购物赫然在列,电子商务领域仍存在诚信危机。作为中国最大的在线商品交易平台,易趣曾向政府有关部门提交了《在线交易管理条例(草案)》的立法建议提案。在今日召开的信用与电子商务高峰会上,国务院信息化工作办公室的司长赵小凡透露,国务院即将审批通过电子商务领域的法律法规,并授权中国人民银行起草企业和个人征信系统,

还将同步修订已有的涉及电子交易方面的法规。赵小凡说,政府要为代表着先进生产力的电子商务发展创造更好的空间环境。目前,国家发改委、商务部、信息产业部等都在做工作。

易趣邵亦波、当当网俞渝、6688王峻涛、8848吕春维、八佰拜张毅、搜易得郭洪驰、云网朱子刚、中国电子商务法律网阿拉木斯等网站总裁,对如何完善电子商务网站信用模式,提出各自的见解,并一致赞成共同构筑诚信事业。许多电子商务网站着力加强信用管理,防范交易风险,比如易趣的实名注册,阿里巴巴的“诚信通”,以及一些网站实施的先行赔偿制度等,都在电子商务信用方面取得了一定成效。

北京大学网络经济研究中心主任张维迎教授主持了今天的这一会议。会上还发布了由北京大学网络经济研究中心所作的一份研究报告,该报告从易趣网上交易的统计和计量分析结果,研究了中国网络信用的现状,并提出建议。报告显示,通过网络出售商品的卖家的累计信用分数有明显的上升趋势,从一定程度上说,网上交易的信用水平向积极的方向发展。一般说来,卖者的信用分数随年龄上升而上升,女性卖者的平均信用分数显著高于男性,收入高的卖者信用高于收入低的,教育程度高的卖者信用高于教育程度低的,参与网上交易活动的人群主要分布在经济相对发达的东部沿海城市,平均信用分数以天津、广州和深圳市最高。卖者的信用分数与其吸引买者浏览次数、吸引重复购买能力以及吸引新顾客的能力密切相关,信用等级高的卖者有显著的优势。据专家评价,这项研究也是第一次对中国网络信用问题进行数量分析。

2004年03月24日

总于可以离开这个令我郁闷的地方,

我的2003,充满着离奇。

有时间好好的写写,由于涉及广州的IT著名企业,

不知道是否要用****公司?

2004年03月23日

利用Windows的GINA(Graphical Identification
and Authentication
)的机制,我们可以方便的在Windows的本机(Local)

实现自定义的认证过程。比如说SmartCard,UsbEkey认证……等.但在Windows的服务器端MS同样提供了一些机制来为我们实现

类似的功能。

以下为MSDN的文档:

Creating Custom
Authentication Packages

If you are supporting a system that defines a new type of logon procedure, such as
retinal scanning or voice recognition, you must create a custom authentication
package
to analyze the new logon data and determine whether to accept the
user’s credentials. You can
also create new authentication packages that use standard logon data but implement
new security protocols.

The LSA calls the Functions
Implemented by Authentication Packages
when it receives an authentication service
request from a logon application. When a user attempts to log on to the system, the
authentication package must check the user’s logon data against the credentials information
on file. The authentication packages provided with Windows store this information
either in the security accounts manager (SAM) database or in the Active Directory
(depending on the version and configuration of the operating system).

Windows NT, Windows 2000, or Windows XP does not permit applications that are not
part of the operating system to access existing credentials data directly; to do so
would create a security risk. To work around this restriction, your custom authentication
package must call MSV1_0 to access the user’s authentication information. Your package
calls MSV1_0 to perform the initial authentication and create a logon
session
. If the initial authentication is successful, your package then performs
additional processing to support the new logon protocol or algorithm and sends an
authentication result to the LSA. In essence, your custom authentication package wraps
MSV1_0, extending its functionality to support the new logon protocol. This following
illustration shows this process.

Creating custom authentication packages

Both the custom authentication package and MSV1_0 support the authentication package
interface (see Functions
Implemented by Authentication Packages
). The LSA calls the authentication package
interface functions in the custom package which, in turn, call the functions in MSV1_0.
The custom package must be able to pass the incoming logon information using data
structures supported by MSV1_0. In addition, the structures passed to MSV1_0 should
be allocated in the address space of the logon process, not the LSA address space.

The MSV1_0 package processes the authentication request and returns a result (and
if successful, an LUID) to the custom package. The custom package can then perform
additional authentication checks, such as deciding whether the scanned-in fingerprint
matches the user account, and return an authentication success or failure back to
the LSA. If your custom package revokes a logon allowed by MSV1_0, it must delete
the logon session created by MSV1_0 by calling the DeleteLogonSession function.

最后如下注册:

Registering Subauthentication
Packages

Each Subauthentication DLL is assigned a DLL number in the range 0 through 255. The
DLL number is used to associate the subsystem calling LsaLogonUser with
the appropriate Subauthentication DLL. DLL number 0 is reserved for the Domain Controller
SubAuthentication Filter. This DLL allows the package to do additional password or
logon validation on a domain controller in addition to that normally done by the MSV1_0
or Kerberos packages. DLL numbers 1 through 127 are reserved Microsoft DLL numbers.
Numbers 128 through 254 are available to independent software vendors. Software vendors
can be assigned a DLL number by Microsoft by sending e-mail to subauth@microsoft.com.
Registering a subauthentication
package
with Microsoft prevents conflict between package IDs when multiple
subauthentication packages are installed on a system.

Microsoft will not assign the value of 255 for any subauthentication DLL. If you are
developing a subauthentication DLL for use only within your company or facility, subauthentication
number 255 is recommended. In this case, it is not necessary to obtain a subauthentication
DLL number from Microsoft.

After you have a DLL number, you can register the DLL under the related authentication
package’s registry key.

The registry location for MSV1_0 subauthentication packages is:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\MSV1_0

The registry location for Kerberos subauthentication packages is:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Lsa\Kerberos

If the required key does not exist, you must create it. Under that key, create a registry
value named ‘AuthN’ where ‘N’ is the DLL number (for example, Auth255).

The ‘AuthN’ registry value holds REG_SZ data and must specify the name of the
subauthentication package DLL. The DLL must be in the default DLL load path.

The authentication package loads the named DLL the first time the subauthentication
package is requested

据我的经验,如果你还你没有得到MS的正式NUMBER,请用”0″即Auth0。

更多的信息参考PlatformSDK的文档

2004年03月22日

葬我于高山之上兮,望我大陆。
大陆不可见兮,唯有痛哭!
葬我于高山之上兮,望我故乡。
故乡不可见兮,永不那忘!
天苍苍,野茫茫,
山之上,国有殇!

2004年03月19日

我平静的递上我辞职书,平静的说出要走的时候。经理有些吃惊。


去年9月随原公司被收购,我们原有的员工到了这家号称广州最好的软件企业工作。


中间经历了许多伴随着收购改有的冲突和矛盾。看到了许多的人间悲喜剧,该走的很早就


走了,兄弟们走的时候,简单的只是说了几句保重。谁都知道留下的也只是在等待离开的时机而已。


在收购者的眼里,我们始终是失败者。

2004年03月18日

计算机的进化

2004年03月17日

我静静的等,等待离去的时候。

不停的问我自己“在这里的两年间,我得到什么?我失去了什么”

在看完一场戏剧般收购游戏之后,我选择了离开。

这不再是我为之激动和奋斗的公司。

我静静的等。等待离去的时候。

Frequently Asked Questions About Visual C++ .NET

Got a question about .NET? Check out the .NET
FAQ
!

Categories

64-bit Support

Is C++ fully supported for 64-bit platforms?

Yes! The freely downloadable Microsoft Platform SDK includes a pre-release compiler
for targeting the Intel Itanium.

Visual C++ 2005 (“Whidbey”) will include fully supported compilers for targeting both
AMD64 and Itanium. The mainstream 32-bit compiler will also generate managed
code that runs on the 64-bit .NET CLR.

What are the benefits of porting to a 64-bit platform?

Porting to a 64-bit platform gives your application several advantages. The
biggest advantage, literally, is a much larger address space. In addition, both
AMD64 and Itanium have access to larger general purpose registers, and more of them.
This usually means better performance. And by porting now, your application
will be one of the front-runners for the upcoming generation of computing!

How can I learn more about porting my application to 64-bit?

Visit the 64-bit
Programming page
on the MSDN Visual C++ Developer Center.

Can I do inline assembly when targeting 64-bit platforms?

No. Unlike the mainstream 32-bit x86 compiler, the 64-bit compilers do not support
inline assembly.

However, there are some alternatives for 64-bit applications. Compiler intrinsics
are provided for almost every machine instruction. Assembly code may also be
written in another file, assembled, and linked that with the C/C++ application.

C++ and .NET

What is “managed code”, and do I have to use it?

Managed code runs within the context of the .NET common-language run-time environment
(CLR). It is not compulsory to use managed code, but there are many advantages
to doing so. A managed code program written with C++, for example, can
operate with the CLR to provide services such as memory management, cross-language
integration, code access security, and automatic lifetime control of objects.

What are “Managed Extensions”?

Managed Extensions for Visual C++ are a syntax extension to the standard C++ language.
These new keywords make it easy for new and existing applications to add support for
the .NET Framework.

What is the “/clr” compiler option?

The /clr compiler option instructs Visual C++ to generate managed code that will run
in the context of the Common Language Runtime (CLR).

What is the .NET Framework?

The .NET Framework is a new computing platform designed to simplify application development
in the highly distributed environment of the Internet. Software running on the .NET
Framework can communicate with software running anywhere else through SOAP and can
use standard objects locally or distributed across the Internet. Consequently, the
developer experience is made consistent so that you can focus on features rather than
on plumbing. You can find out more at the .NET
Framework FAQ
.

How does Visual C++ support Microsoft .NET?

Visual C++ enables developers to optionally incorporate the .NET Framework into their
applications using the /clr compiler option.

What can .NET do for my C++ application?

Enabling your C++ application with .NET technologies will allow you to leverage the
many powerful features of the .NET Framework without rewriting your code. These
include the Base Class Libraries, improved versioning and deployment, code and data
security, and a variety of other features. Adding .NET to your existing C++
code is also the fastest and most cost effective way to leverage future WinFX capabilities
from your existing applications. Incorporating the .NET Framework today is the
best way to prepare for Longhorn tomorrow.

Can I recompile any application /clr?

Any application that compiles clean with the /TP compiler option (compile as C++ code)
can be compiled with /clr. Not all source code will compile cleanly and may
require programmer attention to correct warnings and errors.

In Visual C++ 2005 (“Whidbey”), the process of retargeting existing source code with
/clr is made easier and more powerful, with less programmer attention required.

What are the performance implications of using managed code?

It depends. Purely managed code (no specific use of CLR data types) will
generally run slower, but this is not always the case. For example, the CLR-targeted
Quake II port
runs approximately 5 to 15% slower on most platforms, but runs slightly
faster on Intel Centrino Pentiums.

Microsoft recommends that developers selectively retarget portions of their applications
to the CLR where it makes sense, and to tune the managed/unmanaged boundaries when
and if performance issues arise.

Who actually uses C++ to target .NET in a real application?

Several companies with large C++ source-code investments are using Visual C++ to implement
new .NET-based features. Microsoft (DirectX), Riverdeep (PrintShop), and Autodesk
(AutoCAD) are three companies who use Visual C++ to incorporate the .NET Framework,
and enable their applications with .NET capabilities.

How can I start taking advantage of .NET features without rewriting my application?

C++ has a complete roadmap for taking advantage of .NET Framework for C++ applications:

  • Compiling existing C++ code into MSIL a€“ this allows you to take make use of any
    .NET classes such as .NET remoting, XML classes, etc. from your existing C++ application.
  • Wrapping C++ native classes with managed wrappers which can be used by other .NET
    languages like C#/VB.
  • Writing new .NET components that make use of existing C/C++ APIs as implementation.
  • Writing new verifiable .NET components in C++ as in any other .NET languages.

C++ images can be pure native code, pure MSIL or mixed-mode containing both native
and MSIL, allowing incremental migration to .NET

C++/CLI

What is the relationship between the new C++/CLI features of Visual C++
2005 (“Whidbey”) and Managed Extensions?

The C++/CLI features in Visual C++ “Whidbey” are an evolution of the Managed Extensions
for Visual C++ .NET 2002 and 2003. CLR features are more tightly integrated
with existing C++ syntax and semantics, and provide a cohesive systems language for
making the most of the entire architecture.

Why did the language need revision from V1 to V2?

Customer feedback directed the Visual C++ team to overhaul the original work with
Managed Extensions to devise a more robust and more elegant syntax for Visual C++
Whidbey.

Devices

How does Visual C++ work with devices?

Visual C++ for Devices is the only Microsoft solution for developing native
applications on Windows CE devices.

There is no official support for Visual C++ development for .NET applications using
the Compact Frameworks. However, applications that you build using the /clr:safe
option and that use only CLR and BCL features support by the Compact Frameworks will
be able to run on CE devices.

General

Where can I find MASM?

In Visual C++ 6.0, Professional and Enterprise customers could get the Microsoft Assembler
(MASM) by downloading VC++ 6.0 Processor Pack. Today MASM ships with Visual
Studio .NET Professional and Enterprise as part of Visual C++. ML.EXE is located
in the VC7\bin directory.

Can I continue to write unmanaged applications with Visual C++ .NET?

Yes. Visual C++ .NET can generate both managed and unmanaged applications and components.

Where can I find information on the SCC (source control) interface to Visual Studio?

VSIP Developer Community Center

Register as a VSIP affiliate (free) and download the VSIP SDK Extra which has the
newest MSCCI interface in it.

Can I make my code run on both UNIX/Linux and Windows?

Absolutely, although this often means forgoing some of the great services provided
by Windows and .NET developer platform, including Win32, MFC, the .NET Framework, DirectX, and
interop with Visual Basic and C#. An application using only pure ISO C++ functionality will
generally be portable to any compiler and platform with an ISO C++ compliant
compiler.

If I want to take advantage of .NET, why should I use C++?

Visual C++ allows you to take full advantage of .NET while at the same time giving
you the most efficient and easiest way to interoperate with existing code. It
also allows you to leverage your knowledge of C++ to .NET, rather than having to learn
a new language.

What you get is the combination of a language you know and love, a great managed-unmanaged
interop story, complete .NET support, and .NET features found ONLY with Visual C++
(such as IJW, OpenMP, and templates).

High-Performance Computing

What sort of high-performance computing options will Visual C++ “Whidbey” offer?

Visual C++ “Whidbey” will offers a variety of high performance computing functionality.
Of particular note are the following features:

  • Full OpenMP 2.0 support. This will allow you to use the popular OpenMP API to
    write multithreaded programs, even incorporating .NET based programming.
  • Debugging of parallel applications. Now you can debug MPI and other parallel
    programs with the debugger. It can automatically attach to jobs started on separate
    processes over multiple computers (or on the same one). Plus it adds the ability
    to set breakpoints and get variables, at process level granularity!
  • 64-bit support. Visual C++ now offers full 64-bit support, to allow you to write
    applications not possible in the past.
  • Profile guided optimization. This allows the compiler to generate the most optimized
    code for your program based on real-world profiles that are generated by scenarios
    you supply.
  • New floating point model. With the new floating point model you can get a good
    combination of accuracy and precision, very consistent IEEE compatible results, or
    the fastest floating point code. We now give the user the flexibility
    to choose which would work best for their application.

IDE

What happened to ClassWizard?

ClassWizard has been replaced with several new wizards that individually provide more
control for adding member variables, message handlers, methods, properties, and events.

My IntelliSense disappeared! What do I do?

Currently, some IntelliSense information is contained in the .ncb file.
Sometimes this file becomes corrupted, which means that IntelliSense no longer works.
Simply delete this file, which will trigger a reparse of your project to generate
a new .ncb file.

What happened to the browsing features of Visual C++ 6? I can’t find them in Visual
Studio .NET 2002.

Symbol browsing was moved to the ‘Find Symbol’ feature in Visual Studio .NET 2002.
Inheritance browsing and caller / callee browsing is not available in Visual Studio
.NET 2002.
In Visual C++ “Whidbey”, we’re adding these features back. In addition, they will
now work without the need to create a BSC file or even compile your code.

How do I specify a different file extension for C++ files to be used by the editor
and IntelliSense?

To get a file of a non-standard extension viewed as a C++ file in the VS editor:

In VS .NET 2002, locate the registry key:

HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\7.0\Languages\FileExtensions

In VS .NET 2003, locate the registry key:

HKEY_LOCAL_MACHINE\Software\Microsoft\VisualStudio\7.1\Languages\FileExtensions

Search for the “.cpp” folder under “FileExtensions” and copy the value for the “(Default)”
key.Add a new folder under “FileExtensions” for your desired extension and set the
value of the “(Default)” key to the one you just copied.

To get C++ IntelliSense information on a file of a non-standard extension in the VS
editor, you need to add the extension to the string in the following registry key:

For VS .NET 2002:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.0\Languages\Language Services\C/C++\NCB 

Default C/C++ ExtensionsFor VS .NET 2003:

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\Languages\Language Services\C/C++\NCB Default C/C++ Extensions

How do I copy resources from one project to another?

Open the .rc files in the editor using Open File (Ctrl-O). You can tile the
editor windows vertically and then drag and drop from one window to another. Alternately,
you can create a new solution with both these projects and do the same operation thro
resource view window.

Does Visual C++ take advantage of my SMP machine to compile faster?

In Visual C++ “Whidbey”, the compiler and IDE will take advantage of SMP machines
to compiler faster.

Will Visual C++ ever support Unicode resources?

Yes, we will support unicode resource files in Visual C++ “Whidbey”. You will
just have to save the .rc file as Unicode and set the Character Set property of the
project.

ISO Conformance

Will Visual C++ implement the ‘export’ feature?

In general, Microsoft is committed to implementing the complete ISO C++ standard.
However, Microsoft is particularly committed to delivering features that customers
need. As of yet, the demand for the export feature in Standard C++ has been
minimal. The complexity of the export feature is significant and customer feedback
has shown that resources applied elsewhere now would solve more practical issues.
Over time, we will continue to listen to customer requests and reevaluate whether
implementing export is the best use of our resources.

Language

What are the differences between templates and generics?

Check out this article for a complete answer:

Templates and Generics

Libraries

What is ATL Server?

ATL Server is a new set of native C++ classes that allow developers to create high-performance
native code Web applications and XML Web services. Many of the classes can also be
used in client applications or components that have a need for features such as performance
monitoring support, caching, and thread pooling.

MFC

Do I need to rewrite my MFC application to take advantage of .NET?

Most MFC-based applications represent significant investments in development that
would be thrown away if a rewrite to another language were undertaken. Microsoft
recommends that customers evaluate this cost against the much simpler route of extending
existing MFC applications to take advantage of the .NET Framework. With relatively
little work, an MFC application can be compiled wholly or partially to MSIL, and extended
with new features using any variety of CLR languages, including C++ and C#.

What is the future of MFC?

In Whidbey and beyond MFC remains a core feature of the professional Visual C++ toolkit.
While MFC is not always the best or most modern library for writing new applications,
it continues to offer features that are not available elsewhere. Microsoft will
continue to maintain and extend MFC to make it more secure and robust, and to enable
it to interoperate better with newer technologies and libraries. For example,
new classes and features in Whidbey enable existing MFC applications to be extended
and augmented with capabilities built on the Microsoft .NET Framework.

Will Microsoft continue to support and add features to MFC?

Microsoft has no plans to discontinue support for MFC. New features will
in most cases enable MFC applications to better interoperate with the .NET Framework.

What support does MFC offer for Windows Forms?

Currently there is no explicit library support for Windows Forms in MFC (Visual C++
.NET 2002, 2003).

Visual C++ Whidbey will support Windows Forms interop with MFC, through the introduction
of new MFC classes. You will be able to do the following in an MFC application:

  • Use Windows Forms as modal and modeless dialog box
  • Use a Windows Forms Control as a child window or dialog box control
  • Use Windows Forms Form/Control as an MFC CView, participating in command routing and
    updates.

MFC applications will be compiled easily with /clr compiler option and be able to
take full advantage of the .NET Framework.

Can I recompile an MFC app /clr?

Yes, this is possible. It generally requires some work by the programmer, due
to known and documented issues with the compiler.

Read:

Mixed DLL Loading Problem

Also, Microsoft Regional Director Kate Gregory has published a series of articles
that discusses this topic:

Using Visual C++ .NET

In Visual C++ Whidbey it will be much easier to recompile a MFC application with /clr.
While ANSI-codepage MFC applications can be complied with /clr, we advise you to convert
to UNICODE, because all .NET Framework strings are UNICODE based, and interop with
a UNICODE MFC application becomes much easier. MFC /clr applications will use the
DLL version of MFC and not static library version.

Visual Studio Versions and Upgrades

Can I use Visual C++ 6.0 and Visual C++ .NET on the same computer?

Yes, you can install Visual C++ .NET on a computer that is running Visual C++ 6.0
and use both, system requirements permitting. Different versions of Visual Studio
.NET will also coexist nicely on a single machine.

Where are the Professional and Enterprise versions of Microsoft Visual Basic .NET
and Visual C++ .NET?

The functionality previously available in Professional and Enterprise versions of
the individual language products is now available in the Professional and Enterprise
versions of Visual Studio .NET. In addition, a new Visual Studio .NET Enterprise Architect
Edition is available with tools specifically designed for software architects building
enterprise software, including Microsoft Visio Enterprise Architect Edition.

What is the current version of Visual C++?

Visual C++ .NET 2003 is the current version. It ships as “Visual C++ .NET 2003
Standard Edition”, and with all editions of Visual Studio .NET 2003.

This version was formerly codenamed “Everett”.

What is “Whidbey”?

“Whidbey” is the code name for the next version of Visual C++. The “Whidbey” product
will officially be named “Visual C++ 2005″.

What is the next version of Visual C++?

The version following Visual C++ .NET 2003 will be “Visual C++ 2005″, and is currently
codenamed “Whidbey”. Whidbey will include several new features that enable more powerful
and more elegant development of .NET CLR-based applications. Additional features include
support for developing 64-bit applications, and a new C-Runtime Library (CRT) that
helps write more secure applications.

Does Visual C++ .NET work on Microsoft Windows 95, Windows 98, and Windows Millennium
Edition (Windows Me) operating systems?

These platforms are not supported at design time (Visual Studio will not install on
these platforms). However, programs may be built using Visual C++ that will
run on Windows 98 and Windows ME.

2004年03月16日

看了有关联想公司的裁员的文章,颇有感触。


在商业的社会里,一切都是赤裸裸的商业和雇佣关系。


没有了老毛的年代,那中极高的归属和使命感。我算是赶上老毛留给人民


最大的福利的最后一班车,毕业的时候,国家分配了一个至今未倒闭的水电站,


虽然我现在已经不在单位上班,但感谢GCD,每个月,我还可以拿到500多的生活费。


我怀念老毛的年代,不知道这是不是守旧或迂腐/


至少,在那个年代我不会当心明天我会失业。


在那个年代。单位就是我的家


而今,它不再是,就像联想,无论它多大,都不能给你家的感觉。


保重!

2004年03月12日

在NT的基础上,MS在NT4.0后的操作系统里都提供了很多以SetupDiXXXXX开头的函数,

就是大家经常所说的 SetupAPI.现在举一些简单的例子来说明这些情况:

1,首先我们要访问系统的硬件库,用API SetupDiGetClassDevs,在DDK的文档中,函数的原型如下:

HDEVINFO SetupDiGetClassDevs( IN LPGUID ClassGuid,
OPTIONAL IN PCTSTR Enumerator,
OPTIONAL IN HWND hwndParent,
OPTIONAL IN DWORD Flags );

成功后我们可以得到一个HANDLE,指向DECINFO。Enumerator我们可以指定特定的设备类型,如“USB”,”PCI”等

2,然后利用HDEVINFO hDev 遍历所有的硬件,API原型如下:

WINSETUPAPI BOOL WINAPI SetupDiEnumDeviceInfo( IN
HDEVINFO DeviceInfoSet,
IN DWORD MemberIndex, OUT
PSP_DEVINFO_DATA DeviceInfoData );

在遍历过程中,我们可以用SetupDiGetDeviceRegistryProperty 得到硬件的属性值,如名称,GUID等,可以参考

/ Device registry property codes
// (Codes marked as read-only (R) may only be used for
// SetupDiGetDeviceRegistryProperty)
//
// These values should cover the same set of registry properties
// as defined by the CM_DRP codes in cfgmgr32.h.
//
#define SPDRP_DEVICEDESC
(0×00000000) // DeviceDesc (R/W)
#define SPDRP_HARDWAREID
(0×00000001) // HardwareID (R/W)
#define SPDRP_COMPATIBLEIDS
(0×00000002) // CompatibleIDs (R/W)
#define SPDRP_NTDEVICEPATHS
(0×00000003) // Unsupported, DO NOT USE
#define SPDRP_SERVICE
(0×00000004) // Service (R/W)
#define SPDRP_CONFIGURATION
(0×00000005) // Configuration (R)
#define SPDRP_CONFIGURATIONVECTOR
(0×00000006) // ConfigurationVector (R)
#define SPDRP_CLASS
(0×00000007) // Class (R–tied to ClassGUID)
#define SPDRP_CLASSGUID
(0×00000008) // ClassGUID (R/W)
#define SPDRP_DRIVER
(0×00000009) // Driver (R/W)
#define SPDRP_CONFIGFLAGS
(0×0000000A) // ConfigFlags (R/W)
#define SPDRP_MFG
(0×0000000B) // Mfg (R/W)
#define SPDRP_FRIENDLYNAME
(0×0000000C) // FriendlyName (R/W)
#define SPDRP_LOCATION_INFORMATION (0×0000000D)
// LocationInformation (R/W)
#define SPDRP_PHYSICAL_DEVICE_OBJECT_NAME (0×0000000E) // PhysicalDeviceObjectName
(R)
#define SPDRP_CAPABILITIES
(0×0000000F) // Capabilities (R)
#define SPDRP_UI_NUMBER
(0×00000010) // UiNumber (R)
#define SPDRP_UPPERFILTERS
(0×00000011) // UpperFilters (R/W)
#define SPDRP_LOWERFILTERS
(0×00000012) // LowerFilters (R/W)
#define SPDRP_MAXIMUM_PROPERTY
(0×00000013) // Upper bound on ordinals
也可以在过虑特定的设备如 SPDRP_DEVTYPE = NET。CDROM等。

3。现在我们可以禁止或启用特定的设备了。相关API

SetupDiSetClassInstallParams

SetupDiCallClassInstaller

至此,我们已经做到我们想要的,

程序在VC6,SP5,WinDDK2462 ,Win2000下调试通过。