Re: no static functions in WDK examples;



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;
    ... There is no technical reason not to. ... Also how can I compare two MULTI_REG_SZ buffers returned by ... if (propertyLength!= RtlCompareMemory(myHardWareID, propertyBuffer, ... Windows 2k/XP/2k3 Filesystem and Driver Consulting ...
    (microsoft.public.win32.programmer.kernel)
  • Re: no static functions in WDK examples;
    ... information for their products to OCA? ... Windows 2k/XP/2k3 Filesystem and Driver Consulting ... You also end up with a lot of dumps logged ... There is no technical reason not to. ...
    (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)
  • Re: Careless drivers set to face jail
    ... if not the Police Force lawyer. ... The reason is simple, motorists are allowed take ... Police Officer was in full possession of the facts and if he says the driver ... distraction to motorists, then you are quite free to report them as such to ...
    (uk.transport)