> Class = NetService
So your options are:
-
Write INetCfgXxx code as demonstrated in BindView (or other samples)
-
Use a ready command line tool like NETCFG.EXE on Vista+
-
Use DIXAPI.DLL and call it from your NSIS installer
When I was playing with it earlier, I found if i had I think more than
4 services it wouldn’t let me add a fifth (the filter they made). Is
this a hard limit set by microsoft?
Did it give you some sort of error code? Have you looked at the value of
HKLM\System\CurrentControlSet\Control\Network::MaxNumFilters ?
See: http://support.microsoft.com/kb/2530477 for some official information or search of “MaxNumFilters” and read all about everyone complaining.
I assume it will be too difficult to install the filter only on 10 gbps
cards opposed to all cards?
No, not difficult at all. You need to write a NotifyObject and have it simply decide whether or not to permit or reject a particular binding to an adapter based on whatever criterion you decide. There is a sample NotifyObject in the WDK.
Is there an easy way to install without using an executable?
No. The only way that the APIs that manipulate anything in the system, especially the Network Configuration (NETCFG) is to run an executable. Your NSIS installer is an executable right?
The installer obviously already takes into account it is an admin user
installing it.
Good because it will need to be running elevated to work.
I assume there will be some sort of return code?
From what?
I am used to access the system items in nsis like this
System::Call 'shell32.dll::SHCHangeNotify(i, i, i, i) v
(${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)
Or regsvr32 style by using the nsis regdll “foo.dll”;
Sadly I understood that line of code.
So if there is a way to install the driver in a similar fashion, that
can be very useful.
Yes, use NSIS to exec NETCFG.EXE with the appropriate command line parameters, capture the output, wait for the exit status, and hope for the best. Uninstall is similar.
Obviously i have code that checks operating systems. I believe we are
no longer allowing XP for our software.
Is the NetService an NDIS6 driver? Then it does not work on XP. Do you have a NetService that is NDIS5?
There is one version of the actual file, so i assume its 32-bit that
will get installed on 64-bit systems. They are still getting the
digital signature stuff sorted out for the x64 win 7.
Right now there is the foo.cat, foo.inf, and foo.sys.
FOO.SYS cannot possibly be made to run (same binary) on two different architectures. Your less than helpful devs have given you the x86 (32-bit) driver. You will be getting set for x64. Or alternatively (depending on the INF) you will be getting a single INF, CAT, and two SYS files.
Which brings me to re-iterate a very important point: Whatever process that eventually calls the INetCfgXXX APIs to install this driver *MUST* be running native code. So 32-bit NSIS on an x64 system making System::Call ‘blah’ just won’t do unless ‘blah’ is some DLL you write that figures out a way to ship the request off to some native (x64) helper process that actually does the work.
So if you are believing you will have a single NSIS installer that automagically figures out how to install on x86 (native) and x64 (from WOW64), you will need a scheme to run the actually install action as native code.
Here is a big hint: Imagine a 32-bit DLL that exports NSIS compatible entry points but that wraps an RPC interface to a helper EXE process (which is native code, so you have two of them) which actually makes the installer calls. DIFXAPI.DLL has a reasonable set of APIs for doing this install at a very high level but if you want ultimate control then INetCfgXXX and SETUPAPI is the lower level. I have built all of those and can tell you that after all that, I migrated to MSI as fast as I could.
Sorry for making this such a long winded response just trying to make
sure this is done correctly as the deadline is looming.
I hope that deadline planning included testing. Getting this right is notoriously time consuming and the edge cases around upgrade can be very tricky depending on your requirements.
Good Luck,
Dave Cattley