Re: no static functions in WDK examples;



I would like to agree with you, but from my experience I know of reasons why
this just doesn't work in practice. Two issues that I have encountered in
the last few years.

1. Not able to release full PDBs to OCA: Microsoft is a supplier and
competitor to some companies so providing full symbols including those
'static' functions is not desirable for those type of companies. Since I
was never involved with a company doing virtualization I can use them as an
example. Since VMWare is the leader, do they want to provide full symbol
information for their products to OCA? Maybe they do or not, but I know
others in different businesses do not. With a full PDB you can run a
disassembly pass and get full annotated code. We used that with the
compiler problems on the IA64 as part of the Microsoft provided risk
analysis scripts. Windbg contains pdbcopy that can be used to create a
stripped PDB for those who want it.

2. Some companies do not have a full history of all versions (any
versions?) in their symbol server. Whether that is wise or not is not the
point, but the fact is that it happens. Hardware companies may be more
likely to use hardware types who do software and not have as much background
in software engineering. Hardware companies are more focused on the
hardware and software is just a necessary evil that may be mostly ignored.



"Don Burn" <burn@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:erucmUuzIHA.2384@xxxxxxxxxxxxxxxxxxxxxxx
That is what a good symbol server is for, so you don't have to worry about
this. Actually, even a decent source control will do this. Personally,
I find the advantages of using static highly outweigh the possible
problems of symbols, the symbol argument belongs to several decades ago,
not today.


--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply




"David Craig" <drivers@xxxxxxxxxx> wrote in message
news:e4g95tqzIHA.1772@xxxxxxxxxxxxxxxxxxxxxxx
It is OK to use static functions, however it might not be advisable to do
so. If you have a driver released to millions of customers and all you
get for most dumps is just a minidump, how do you locate the function
where you were last processing? Yes, a map file can help, but it makes
it much more of a manual process where you have to get the map file for
the version the dump reflects as running. Then you have to do the math
to locate the function. You also end up with a lot of dumps logged
against your exposed function when it really is not that function that
was involved. Also having a symbol server helps but unless you release a
full symbol PDB to Microsoft's OCA system it will still require you to
download the dumps and check them with windbg.

If you have functions you prefer to keep confidential then the above
advise may not apply. If you have such a function, I would recommend
that you call any outside function from one of those you do it through a
public function. It just makes the stacks easier to follow. I have been
in two places where having a lot of dumps even though the number of bugs
attributable to the company's code was actually very few.

As each new release hits the world monitoring OCA at Microsoft is a wise
investment. Having someone in QA checking every week for patterns is a
good thing to do. Sometimes there are a class of crashes that while OCA
gives them to you, are really in other components. Microsoft has a bias
in the OCA analysis that looks for drivers other than Microsoft's to
assign the bug. If you get hold of Microsoft you can get them moved so
the real problem can be found.


"pradeep bisht" <pradeep_bisht@xxxxxxxxx> wrote in message
news:79baff43-8a4b-458c-84cc-11d208f972b6@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks Don for replying even though I just realized that I posted to
the wrong list instead of posting to the driver's list :(.

So it is OK to use static.

On Jun 14, 1:29 pm, "Don Burn" <b...@xxxxxxxxxxxxxxxxxxxx> wrote:
Comments inline:

"pradeep bisht" <pradeep_bi...@xxxxxxxxx> wrote in message

news:b2b4c37c-b61c-4ef7-8a2f-00c014eff55e@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I don;t see any "static" functions in WDK examples. Even though there
are functions which are used inside only one file. Generally if a 'c'
function local to a file is declared static. Is there a technical
reason for not using static?
[I'm new to driver development so may this question is stupid.]

There is no technical reason not to. Personally, I hve always found
this
frustratng since there is no reason not to make things static.



Are there any general guidelines for writing drivers (disk filter
drivers, to be more specific). Thanks.

Also how can I compare two MULTI_REG_SZ buffers returned by
IoGetDeviceProperty when called for DevicePropertyHardwareID?
Currently I'm just comparing each character (in a for loop) upto
ResultLength returned by IoGetDeviceProperty.

for (i = 0; i < propertyLength; i++) {
if (myHardWareID[i] != propertyBuffer[i]) {
break;
}
}

if (i != propertyLength) {
DebugPrint ("Not matched");
}

For the compare use:

if ( propertyLength != RtlCompareMemory( myHardWareID,
propertyBuffer,
propertyLength) ) {
DebugPrint ("Not matched");
}

--
Don Burn (MVP, Windows DDK)
Windows 2k/XP/2k3 Filesystem and Driver Consulting
Website:http://www.windrvr.com
Blog:http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply







.



Relevant Pages

  • Re: no static functions in WDK examples;
    ... Windows 2k/XP/2k3 Filesystem and Driver Consulting ... Yes, a map file can help, but it makes it ... You also end up with a lot of dumps logged against ... As each new release hits the world monitoring OCA at Microsoft is a wise ...
    (microsoft.public.win32.programmer.kernel)
  • Re: no static functions in WDK examples;
    ... If you have a driver released to millions of customers and all you get ... Yes, a map file can help, but it makes it much more ... You also end up with a lot of dumps logged against your exposed ... As each new release hits the world monitoring OCA at Microsoft is a wise ...
    (microsoft.public.win32.programmer.kernel)
  • Re: no static functions in WDK examples;
    ... If you have a driver released to millions of customers and all you get ... Yes, a map file can help, but it makes it much more ... You also end up with a lot of dumps logged against your exposed ... As each new release hits the world monitoring OCA at Microsoft is a wise ...
    (microsoft.public.win32.programmer.kernel)
  • Re: "All speeding unacceptable" - IAM
    ... Do you believe that if the reason isn't readily "apparent", ... If the driver had been insured, of driving age and stone cold sober ... I simply haven't seen the accident and I can't ... A child runs out in the road, a sober but speeding driver is unable to ...
    (uk.rec.driving)
  • Re: Advice Needed - Car Scratched while travelling
    ... thinks the other driver is in the wrong if some form of offence is ... >>> not give it to the police. ... >> person, vehicle, structure or animal, the driver of the motor vehicle ... >> motor vehicle for any reason does not give his name and address to any ...
    (soc.culture.singapore)