|
Prev: Vista Magnification API: MagSetImageScalingCallback() doesn't work?
Next: Vista Magnification API: MagSetImageScalingCallback() doesn'twork?
From: pradeep bisht on 14 Jun 2008 15:40 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.] 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"); }
From: Don Burn on 14 Jun 2008 16:29 Comments inline: "pradeep bisht" <pradeep_bisht(a)yahoo.com> wrote in message news:b2b4c37c-b61c-4ef7-8a2f-00c014eff55e(a)u12g2000prd.googlegroups.com... >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
From: pradeep bisht on 15 Jun 2008 00:32 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...(a)stopspam.windrvr.com> wrote: > Comments inline: > > "pradeep bisht" <pradeep_bi...(a)yahoo.com> wrote in message > > news:b2b4c37c-b61c-4ef7-8a2f-00c014eff55e(a)u12g2000prd.googlegroups.com... > > >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
From: David Craig on 15 Jun 2008 01:48 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(a)yahoo.com> wrote in message news:79baff43-8a4b-458c-84cc-11d208f972b6(a)z16g2000prn.googlegroups.com... > 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...(a)stopspam.windrvr.com> wrote: >> Comments inline: >> >> "pradeep bisht" <pradeep_bi...(a)yahoo.com> wrote in message >> >> news:b2b4c37c-b61c-4ef7-8a2f-00c014eff55e(a)u12g2000prd.googlegroups.com... >> >> >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 >
From: pradeep bisht on 15 Jun 2008 03:58
Thanks David for the words of wisdom. it makes lot of sense. On Jun 14, 10:48 pm, "David Craig" <driv...(a)nowhere.us> wrote: > 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_bi...(a)yahoo.com> wrote in message > > news:79baff43-8a4b-458c-84cc-11d208f972b6(a)z16g2000prn.googlegroups.com... > > > 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...(a)stopspam.windrvr.com> wrote: > >> Comments inline: > > >> "pradeep bisht" <pradeep_bi...(a)yahoo.com> wrote in message > > >>news:b2b4c37c-b61c-4ef7-8a2f-00c014eff55e(a)u12g2000prd.googlegroups.com... > > >> >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 |