Custom event messages with NDIS driver - windows

I'm trying to define a few custom Event Viewer events. I've been following the instructions in MSDN and few other online sources, yet the event viewer can't find the associated text data.
This is what I've done:
Created an input file for the message compiler with the event codes and relevant strings (following the WDK Serial driver example).
Included the .rc file generated by the message compiler in the main driver resource file (MyDriver.rc).
Included the header file generated by the message compiler in the relevant driver module.
Used the NdisWriteErrorLogEntry API to write events with new ids from the included header file.
Added the driver binary to the Inf registry string identifying the event sources:
HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll; %%SystemRoot%%\System32\drivers\MyDriver.sys"
HKR, , TypesSupported, 0x00010001, 7
Everything works, except for strings display by the event viewer. It doesn't seem to recognize them and displays "the message resource is present but the message is not found in the string/message table" in the event description.
The only significant difference from the WDK example is the usage of NDIS API instead of the generic WDM API.
I'm also pretty confident that the text is included in the driver binary, since when opening the .sys file with editor I clearly see my strings there.
Would appreciate any suggestions on this issue.

Well, after a year and a half I found the problem. Apparently, the event viewer registry string parser is unable to properly extract the second messages file name if there is a whitespace before it.
Thus, in order to fix it, all is needed is remove the whitespace. I.e., instead of:
HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll; %%SystemRoot%%\System32\drivers\MyDriver.sys"
Write this in the inf file:
HKR, , EventMessageFile, 0x00020000, "%%SystemRoot%%\System32\netevent.dll;%%SystemRoot%%\System32\drivers\MyDriver.sys"

Related

how to create customized messages in veins

I'm simulating a scenario in veins when I need to use customized messages with specific fields(it's not wsa,wsm or bsm).
to achieve this I defined .msg file and the .cc and .h file were generated successfully. I included .h file into the cc+ application code, the project builds without errors but when I launch the simulation I have the following error
Model error: WaveMac only accepts WaveShortMessages -- in module (Mac1609_4) MyNetwork.rsu[0].nic.mac1609_4 (id=12), at t=0s, event #1
is it impossible to use customized messages in veins ?
if it's possible how to do it ?
Feel free to amend as many fields as you want to one of the existing message types (or to inherit from them). The bit length of a message is configured separately (in the .ini file of a simulation), so how many fields are in a message has no impact on how the simulation behaves.

Make a file searchable by Windows

I was just wondering something and I could not find it.
Is it possible to make a custom file format that is searchable by Windows? Like Word or HTML files are searchable.
I've written a program that has a custom file format (extension) associated. It would be nice if windows could search inside that file.
It looks rather involved. Essentially, you provide an implementation of a COM interface for your file type, which lets the search indexer discover what's in your file.
From MSDN:
You can extend Windows Search to index the contents and properties of new file formats, and data stores using data add-in interfaces. To create Windows Search add-ins, third-party developers must first implement a Shell data store, and then develop a protocol handler so that Windows Search can access the data for indexing. If you have a custom file format, you must develop a filter handler to index file contents, and a property handler for every file type to index properties.

extract the filename from MQ Message header

Iam using Websphere MQ V8.
I need to get the filename from the header in incoming message file. Is there any properties or default methods available to get it.
Sample File:
The file ame you show in the non-hex dump of your message was put there by the sending application. You should ask the sending application how it was put in there, so that you can know how to pull it out.
Alternatively, show the hex version of your message as well and we might be able to help you further. All the important stuff is not visible to us in your screen shot.
That looks like an RFH version 1 header (not RFH2) but as Morag said, we need to see a hex dump of the message. There are lots of tools to see the hex dump of the message. i.e. amqsbcg, MO71, MQ Visual Edit, etc...
From the manual:
The RFH header guidelines only allow for a single header to exist in a message. The fixed binary set of properties is followed by a variable set of name/value pairs.
strucid
version
struclength
encoding
codedcharsetid
format
flags
namevaluestring
The filename is in the "namevaluestring" section and as Morag said, you need to have a discussion with the sending application to understand the format they used.
Finally, if this is a new sending application being developed then tell the developer to NOT use RFH version 1 but rather message properties.

IPropertyStore interface not called in a property handler

I am developing a property handler implementing IPropertyStore and IInitializeWithFile, testing on Win 8.1 x64. Property names were previously added to the system using a .propdesc file properly registered using prop.exe.
I used PROCMON.EXE to monitor the events when I re-indexed my files on disk. SearchPrototocolHost.exe loads the protocol handler, initializes it properly with IInitializeWithFile (the properties from the file seem to load OK from the file) then proceeds with PSCreatePropertyStoreFromObject presumably to retrieve the IPropertyStore interface and start retrieving the properties from the file.
Then nothing else happens, the methods from IPropertyStore are never called. Instead, SearchPrototocolHost.exe issues a CreateFile on the file to be indexed again with "Open Reparse Point", fails at getting a QueryRemoteProtocolInformation, closes the file then proceed with the next file to index.
Why does my property handler fail (is it a security issue, etc.?)?
It looks like one needs to add to the registry entry:
"HKLM" "SOFTWARE\Microsoft\Windows\CurrentVersion\Shell Extensions\Approved" {My_CLSID}
where My_CLSID is the GUID of my property handler!
I don't know if this is a specific requirement for handlers using IInitializeWithFile as an extra security precaution.
After three weeks of banging my head against walls, now I can "hear" the IPropertyStore methods (using MessageBeep...) when they are called by Explorer. Never mind that they crash Explorer, at least I know that IPropertyStore is not blocked!

Send Email with pdf file as attachment in rhomobile

I want to send email using mailto tag with a single pdf file as attachment.
mailto tag opens the mail window with passed arguments like to and subject using:
Mail to Manager
But, attachments as a parameter isnt working.
Please suggest how to send pdf attachment in rhomobile.
Thanks
I think that you need to add the physical path to the PDF file for it to work (otherwise it may not know where the file is). This post on a forum says as follows:
The only problem is that this "mailto" command executes on the
client machine, therefore it tries to locate the attachment file by
a physical path, and not by a virtual path.
That is,
Using mailto:iudith.m#zim.co.il?subject=my report&body=see attachment&attachment="\myhost\myfolder\myfile.lis"
works ok, but only for local users (those connected to the same
network as the "myhost" machine).
Using mailto:iudith.m#zim.co.il?subject=my report&body=see attachment&attachment="http://myhost:myport/my_location_virtual_path/myfile.lis"
does not work, it does not recognize such a syntax as valid for
the attachment file.
In your case you would properbly need to look at this part of the Rhomobile docs (on file system access) to get the right path to your file.
EDIT:
From you comment I can see that you are trying to make it work on iOS (due to the iOS specific path).
In this discussion (from Rhomobile's Google Group) it is explained that mailto doesn't support attachments on iOS. It says as follows:
Don't know about other platforms, but you cannot do this on iOS. mailto: does not support attachments on iOS.
You can do it using a native API, MFMailComposeViewController.
This is a complete controller with UI, so you would have to write a Native View Extension to use it:
http://docs.rhomobile.com/rhodes/extensions#native-view-extensions
EDIT 2:
I've looked around and it seems that mailto doesn't support attachments on Android either. This is because Android supports the RFC 2368 mailto protocol, which doesn't include attachments. Here is a reference to the Android mailto url parser.
I would suggest that you do as suggested for iOS, write a native extension. I think this post would be relevant for you.

Resources