IOCTL's from a static library linked to KMDF driver

Hi,
Im trying to build a static library that can be used across multiple KMDF drivers. The library needs to send IOCTL's to another driver to access required functionality. 
The library does not have access to the Wdf device object/objects of the KMDF drivers it is being linked to. 
To send IOCTLs from the library, i thought i would use WdfIoTragetCreate/open and then use WdfIoTargetSendIoctlSynchronously. However, to create the IO target, i require a device object. 
I thought i could call WdfGetDriver to get the driver object and create a dummy device object with no callbacks. However, all the examples and documentation seems to indicate that you only call WdfDeviceCreate inside EvtDeviceAdd or  EvtChildListCreateDevice callback,
or from a call to WdfPdoInitAllocate. 
Is it incorrect to call WdfDeviceCreate from a library which will be used way after the KMDF driver has come up ? 
What options do i have to be able to send IOCTL's to other drivers from this static library?
-R___K

You need to pass in the actual device object, one of the many things that WDF does for you is cleanup things like reference counts etc, so you don't want to be using a dummy device object, since you will be entering the area of having to worry about when
to clean it up.
Since it is a static library you can use WDF calls unlike a DLL. 
Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com

Similar Messages

  • Can the aTV read files from an iTunes library on my nas drive without my computer being on

    I have my itunes library on a My Book Live nas drive that contains all of my digital movies and TV shows. I want to be able to watch my movies from the library without a computer running. I understand that Apple has chosen to chain you to the computer and your itunes account through Home Sharing but I can not see why they couldn't allow you to access a nas drive without a computer running because your aTV is tied to your itunes account also so why do they force you to run a computer 24/7 365 in order to access the files you have bought and paid for.
    I have a love/hate for Apple because I love the quality of the products they make but I hate how they make all of the digital files you purchase only accessible through a computer running Home Sharing even though the files are not stored on the computer.
    I have tried several things to get this to work without a computer but no luck. The only way I have found to be able to do this is to Jailbreak your aTV and install 3rd party software (which I don't want to do) that will allow you to by pass the computer and Home Sharing (which is dumber than ****) because that is all I want to do is eliminate the need of a computer running wasting electricity (I thought Apple was supposed to be an enviro friendly company, guess not). I am not trying to steal or give someone else my purchased movies and using the aTV and an internet connection they could still be able to tie your media to your itunes account so I just don't get there thinking, or lack of thinking I should say.
    Is their a way to do this without Jailbreaking or modifying your aTV?
    If not is Apple ever going to wake up and allow there customers to actually USE the media they purchase from them without Home Sharing and a computer running?

    _Skull wrote:
    Can the aTV read files from an iTunes library on my nas drive without my computer being on
    no it can't. you need itunes open and running

  • [SOLVED] Trouble with atlas-lapack static library linking to our .so

    I'm trying to compile a massive hunk of software, one small piece of which is libgraphics.so.   The build system, based on cmake,  is trying to link a static library from lapack to make the libgraphics.so but failing with this:
    Linking CXX shared library libgraphics.so                                                                                     
    /usr/bin/ld: /usr/local/lib/liblapack.a(dgetrf.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
    /usr/local/lib/liblapack.a: could not read symbols: Bad value
    collect2: ld returned 1 exit status
    make[2]: *** [graphics/libgraphics.so.3.1.0] Error 1
    Thinking lapack.a somehow wasn't built right, after some fussing I ended up removing  the blas, lapack, and atlas libraries and reinstalling them from the AUR atlas-lapack (ver 3.8.3)  package.  This is where they had come from originally just a few months ago, when I first tried to compile this massive app.    Maybe now something in atlas-lapack got fixed?  No.   Apparently it builds static libraries without -fPIC, or something else is going on to result in this error.  I didn't see anything obvious in the PKGBUILD file to change. 
    Now I'm stuck, out of further ideas to try...
    Last edited by darenw (2010-10-06 20:48:40)

    Problem solved.  CMake was finding a stray old .a file (w/o any .so files with it)  in /usr/local/lib while the good new .a and .so files were in /usr/lib.     Deleted the old .a, reran cmake.  Now make runs fine.   -fPIC had nothing to do with the solution.

  • Using a static library (Windows)

    I have a static library in C++ (Windows). I know how to invoke methods in a dll.
    Is it possible to invoke methods from a static library also, and how?
    Thanks you.

    I suppouse that you only have to do a DLL with the static library (pretty much like recompile the static library so it can be dinamically linked, or something similar, including the correct JNI method naming).

  • How to link a static library in java

    Hi all
    I would like add a static library (with an extension of ".a") to my java program
    and use the rutines in it. I made a search on the Internet but could not find much.
    The library created by compiling several fortran programs.
    Does anyone know how to do this (linking & calling the subrutines)
    Thanks

    Thanks for the suggestion and for the tip again. I am doing what
    you suggested (writing a C program to interface java with that static library
    ( ".a") ) But where in the C code do you specify and include that static library?This is mainly a linking issue. Suppose the FORTRAN API exposes the following
    functions: FBQ001, FCQ042 and FDB005 (well, this is FORTRAN, so the names
    should be silly ;-)
    For the sake of simplicity, assume that these three routines don't take parameters
    and don't return a value.
    You could create a little Java class that could (indirectly) access those three
    routines:public class FORTRANWrapper {
       public static native void FBQ001();
       public static native void FCQ042();
       public static native void FDB005();
       static {
          System.loadLibrary("wrapperlib");
    }Note the little static block that loads your own wrapper lib. Read on:
    use javah against this little class above. It'll generate a .h file containing the
    prototypes of the three wrapper functions for your FORTRAN API.
    Note the funky names generated by javah. Don't change them but create a
    simple .c file with the implementation of those functions. These functions
    should simply call the FORTRAN functions; check your manuals how to
    call FORTRAN routines from C.
    Finally, compile your .c file and link it against the static FORTRAN .a library.
    Use the correct linker flags (system dependent stuff here) to create a
    shared object (.so) file. This should generate your wrapperlib.so file,
    loaded by the System.loadLibrary method (see above).
    kind regards,
    Jos

  • Problems creating a Native Extension linking to a static library

    Hi,
    I'm trying to create my own Native Extension for iOs that will use another static library.
    My problem occurs when I try to package my app with ADT: after a lot of "ld warning: unexpected srelocation type 9" , I get a final error : "ld: thumb bl/blx out of range (-4468380 max is +/-4M)"
    This may be caused by the fact that the static library I am using needs the gcc setting "compile for thumb" turned off. I've done that in XCode to get my .a file to generate my .ane, but how could I tell ADT to take it into account ?
    Thank you for your help !

    Are you compiling for ARMv6 or ARMv7?
    With armv7, you do not need to switch off the "compile for thumb" anyways.
    Also, I guess you are using an iOS version greater than 4.3 to compile your native library. In this case, using -platformsdk switch of adt, while packaging your application might  just resolve your issue.(You will see some ld 4-byte alignment warnings, but thats ok)
    -Neha

  • Creating a static library with XCode cross-project references.

    I have a project and am trying to move a lot of the code into a static shared library, and added a cross project reference to this library in my app.
    However, when I moved a file from my app to the library (removing the reference in my app and moving the file to the library's project directory), and try building my app, I get compiler error messages as if the file I have moved doesn't exist.
    When I build my library project, it says the build has succeeded, but the library.a file remains red. It is also red in the my referencing app project.
    If anybody has any experience setting up cross-project references in XCode, I'd appreciate any help.
    If it helps identify where the problem is, I've performed the following steps to setup the library and cross-project reference:
    1. I created a new Cocoa Touch static library project in XCode which would house the shared code.
    2. I changed the global settings in XCode to place the build products in a shared build directory (rather that the project directory), and made sure the intermediate build files are placed with the build products.
    I changed this using the Preferences menu, but have also gone into the project info for both my app project and the library project and made made sure it is set to place the build projects in the custom shared build directory.
    3. I then added a Source Tree, and made sure that the Path of the project directory of the library project.
    4. I added a project reference to the library project's .xcodeproj file in my application project. I changed the library project reference so that it was relative to JIGSAW24LIBRARY.
    5. I configured the library dependencies by going to my app's target's info, and adding a direct dependency to the library project.
    6. In my app's info build tab, I changed the user header search paths so that it uses the search tree I setup (I used the $(SEARCHTREE_NAME) notation, but checked that this resolves to a valid path). I also made sure that the Always Search User Paths checkbox is checked, and that the Library Search Paths is blank.
    7. I click-dragged the library.a file under the library project so that it was under the Link Binary With Library sub folder of my app's target.
    For step 5, I've also tried adding the reference to the other project as a linked library, rather than a direct dependency, but this doesn't seem to work either.

    I managed to fix the problem. The steps above seem to be correct. The problem seems to be related to the source trees that are defined...
    I was previously using an absolute path for the source tree which pointed at the folder containing the library project. I changed this to a relative path to the same folder (relative from the calling project) and this seems to fix it.
    I'd double checked that the absolute path specified was correct, so it looks like the user header search paths specified must be relative to the current project.

  • How to create a static library in Xcode 4.2

    I need to make a static library from a project that consists of only two files, a c module and a header file.  I haven't used Xcode before, but had no problem figuring out how to create a new project and setting up what seemed like reasonable the build options, and the build reports success.  But no output files are being created.
    I figured it was time to dig into the documentation, but when I did some searching I turned up several horror stories about not being able to get this to work.  And from people who appear to know a lot more about this than I do.  So I thought I'd ask--is it a problem doing what ought to be a relatively simple task using Xcode 4.2?
    This is not an iOS thing, just a C function that I need to call from Python.
    Any suggestions as to how I can get this to work?

    Thanks for the response.  Yes, that's how I started.  I have now managed to get it to build static libraries; the piece I was missing was the scheme stuff.  I also tried to build dynamic libraries, but still no luck with those.  It was a little confusing because sometimes if I started a new project the scheme would allow me to create output as is; other times I had to edit the scheme first.  So reading the documentation appears to have paid off after all.
    FWIW, what I was trying to build was a missing library needed for a project in Python.  The entire project has two C libraries, which I've managed to build now, altough I don't know if there are some specific options that I need to set for them to work with the C wrapper.  The C wrapper is written in Cython, which creates a C file from Python-like statements.  The end result of linking the two libraries and the compiled C wrapper should be a file that can be imported into Python, which should have an extension of ".so".
    So far the last part is not working, so I don't know if the problem is with the build settings for the libraries, or something else.

  • How to create a static library using xcode ?

    Hi,
    I need to create a C static library using xcode in order to use it in another developement environment which is Free Pascal Compiler/Lazarus.
    I have very few knowledge about C. I just know how to program the function I need and I've already written my C function using xcode.
    Using Lazarus (Pascal IDE), for example, as I use IOKit, I have declared the path of IOKit in the linking section (that is /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/IOKit.framework/IOkit) . IOKit is a unix executable, and I can use the exported functions it contains in my Pascal code.
    So, I would build such kind of unix executable where I can put my own functions written in C. But I can't figure out how to do it.
    How to export my functions ? Must I use some specific C keywords to "publish" them (export, __export,...) ? How to create an executable file like IOKit ? Which kind of project must I choose in XCode ?...
    André.
    Message was edited by: sinfoni12345
    Message was edited by: sinfoni12345

    Thanks for the response.  Yes, that's how I started.  I have now managed to get it to build static libraries; the piece I was missing was the scheme stuff.  I also tried to build dynamic libraries, but still no luck with those.  It was a little confusing because sometimes if I started a new project the scheme would allow me to create output as is; other times I had to edit the scheme first.  So reading the documentation appears to have paid off after all.
    FWIW, what I was trying to build was a missing library needed for a project in Python.  The entire project has two C libraries, which I've managed to build now, altough I don't know if there are some specific options that I need to set for them to work with the C wrapper.  The C wrapper is written in Cython, which creates a C file from Python-like statements.  The end result of linking the two libraries and the compiled C wrapper should be a file that can be imported into Python, which should have an extension of ".so".
    So far the last part is not working, so I don't know if the problem is with the build settings for the libraries, or something else.

  • Is that possible to call a static library?

    Hi,
    I'm using JNI to call a third party static library (.a file), but I always got the java.lang.UnsatisfiedLinkError. I'm not sure whether it is possible to invoke APIs from static c libraries. Anyone here has this kind of experience ?
    Here is my scenario:
    I have a native method in java class named sendMessage(), and implement this method in message.c(function: Java_MessageSender_sendMessage()) by calling a API in a third party static library(msg.a). However when I run the java class, I always got the error. But If I just run the main() of message.c which also calling the Java_MessageSender_sendMessage(), it will be ok.
    some code of c file:
    Java_MessageSender_sendMessage()
    printf("hello");//this line can be executed
    sendMessage();//this line is calling the static library, and error occurs here when the function called from java side
    int main(int argc, char *argv[])
    Java_MessageSender_sendMessage()//It's ok when directly run this application
    Any information will be helpful to me.
    Thanks in advance

    Hi, bschauwejava
    Thanks for your reply.
    As you have said, the static libraries already have been linked when I made the libmessage.sl using aCC:
    aCC -z -b -o libmessage.sl message.o -lmsg
    Is there anything wrong with the command?

  • Errors for building ios static library in adobe air

    Hi
    I am trying to add Twitter framework(MgTwitterEngine) in Native extension for adobe air. I added files and respective delegates in the same way like I did in making Native iPhone app using xcode. I added libxml2.dylib in xcode and added its path in “Header search path” and it builds with no error on xcode. When I try to compile static library in adobe air it gives me errors like Xmlfree.. referenced from etc which means we need to add options for libxml2 in adobe air too. Can you please tell me how can I add library path and itself if needed? thanx for your help in advance.
    With my best,
    Amir

    1) There are 2 steps for this: You need to use the -platformoptions switch while packaging your ANE, along with an xml file, which contains the linker options.
    Details may be found at:http://help.adobe.com/en_US/flex/mobileapps/WSe4e4b720da9dedb5-4aefe03513238d8a1b8-8000.ht ml
    and http://blogs.adobe.com/rajorshi/2011/11/16/ios5-support-for-airusing-external-sdks-to-pack age-apps/
    2) You need to use the -platformsdk switch of ADT while packaging your IPA, and provide the path to iOS SDK to the same.
    -Neha

  • New PC and want to move library to a different drive location from original PC

    I've just built my self a new PC and would like to move my iTunes music to my new PC.
    I know this is a pretty straight forward thing to do as I have done it on more than one occassion before without any hassle.
    It's a little different this time though, I need to move the libary to a different drive from the default location as my C: drive is an SSD and can't fit my entire libary on it.
    I've got my iTunes music folder backed up on an external drive, I thought it would just be a case of installing iTunes on my new PC copying my music to the drive I want it on and telling iTunes that this will be my new storage location.
    After a bit of playing around I managed to get iTunes to see all my music again.
    I'm having trouble getting it to find my cover artwork though and my old ratings and playlist count.
    Does anyone know how to restore these?
    Also do I have to have 2 iTunes fodlers on the computer? 1 in the stanard C: drive loaction and 1 where I now have all my music. Can I not just have it all on the 2nd drive?
    If I copy the 4 libary files from my backup into the new folder it gives me my old ratings and playlist count back but loses all the artwork and most of the files have broken links to them.
    Sorry if I've not explained what I am trying to say very clearly, thanks for any help.

    In iTunes under Edit > Preferences > Advanced turn off Keep iTunes Media folder organized, then click OK.
    Use Edit > Preferences > Advanced to change the media folder location to D:\Music\iTunes\iTunes Media, then click OK. If iTunes asks to consolidate or move any files at this point say no or cancel.
    Open the menu File > Library > Organize Library... tick Rearrange files in the folder "iTunes Media", and click OK.
    In iTunes under Edit > Preferences > Advanced turn on Keep iTunes Media folder organized, then click OK.
    Open the menu File > Library > Organize Library... tick Consolidate files, and click OK.
    This should rearrange the media folder into the current structure with the minimum amount of physical file moves.
    At this stage you should find that iTunes is now looking for your mobile apps at D:\Music\iTunes\iTunes Media\Mobile Applications. Check the properties of a single app just to make sure. If all is well you can reclaim the space on C:.
    If it were me at this stage I would now close iTunes, then copy the library files and album artwork folder from wherever they are on C: into D:\Music\iTunes then shift-start-iTunes and choose the library at D:\Music\iTunes. It is at this point that the library is now truly portable.
    Having made that work I would then close iTunes, move the iTunes folder up to D:\iTunes and shift-start-iTunes to open it, but that's my preference.
    tt2

  • I have 2 Macs - an iMac that holds my entire iPhoto library and a Mac Book Pro that I use to hold a subset of the main library - how can I transfer photos and their metadata from the main library of the iMac to my Mac Book?

    I have 2 Macs - an iMac which holds my main iPhoto library and a Mac Book Pro which holds a subset of the library. How can I transfer photos and their metadata from the main library to the smaller 1 on the Mac Book Pro?

    Link the two Macs together and use iPhoto Library Manager
    Regards
    TD

  • How to automatically remove the wiki page's images from the Images library , when a wiki page is deleted

    I have noted the following strange behavior inside my Publishing enterprise wiki site collection. Now by default when I create a new wiki page and I add Pictures to it, the pictures will be saved under the “Images” library and will be inside a unique folder
    that have its name similar to the page name.
    But when users delete the picture from the wiki page or they delete the whole wiki page, then the related folder inside the “Images” library will not be removed. So can anyone advice if there is a way to automatically remove the page’s pictures
    folder from the Images library when the page is deleted? as currently i might end up having many pictures inside the Images library which are not linked to a wiki page, and they will waste my server desk space...

    I think, not sure, there's no out-of-the-box solution in SharePoint for this problem. So I can only think of custom solution:
    In event Receiver, ItemDeleting, you can delete images. The only downside is if some other pages are referring the images..... you need to check somehow which is quite time-consuming operations if you have thousand of pages in wiki library
    A timer job, that will run periodically, every day or week, and clean all unused images. 
    Hide the default delete button and add your own. And then using your own custom layout page, show a 'configuration dialog' to user if they want to delete both page and images.
    Thanks,
    Sohel Rana
    http://ranaictiu-technicalblog.blogspot.com
    Please do not tell me this is not supported out of the ox ,,,,, i that i should handle this process by myself !!! and SharePoint does not support this feature .... this is another  problem i should include in my list .....

  • Using the Remote App and playing iTunes from a shared Library

    I have a playlist set up in my main iTunes library on my iMac.  This is a shared library on my local network at home.  I can access and play the library remotely from my MacBook.  I want to move my MacBook outside with external speakers for a party.  I want to be able to access the shared library from the iMac inside the house from my MacBook and be able to control it with the Remote App.
    My problem is that when I use Remote and the MacBook outside (I've set up the iTunes passcode with that computer and my iPod) it will only recognize the library on that computer, even if I am logged in to the shared library and it is visible in the MacBook.  So basically, remote is doing what it is suppose to do in a normal situation, but I need it to recognize and play from the shared library.
    When I turn on home sharing on the iPod I can access all the libraries on the various macs in our house, but the music will only play out of that particular machines speakers.
    I don't have wireless speakers, so I can't think of another way to do this.  Is there?
    Thanks, Sandy

    Well, I've got it to work although not ideal. 
    1. On my main computer (iMac) I created the playlist that I want available to control at a party.
    2. I went to iTunes settings/Sharing and selected "Share selected playlists" and checked the playlist I made for a party.
    3. I Linked my iPod to MacBook (which is outside with external speakers) using the 4 digit code
    4. iPod, Home Sharing Off
    5. Select the Library on iPod
    6. Select "More" (bottom right of iPod)
    7. Select "Shared" from the list that appears
    8. Select the computer that has the shared library
    9. Select the playlist (or lists if you created others)
    This setting is allowing me to use my iPod "Remote App" to play an iTunes playlist (or the entire catalogue) from a shared library on my MacBook WITH the sound coming from my MacBook and NOT from my iMac where the original iTunes catalogue is located.
    Not sure if this is the easiest way, but it's working.

Maybe you are looking for

  • Compatability with microsoft word

    I cannot seem to make the word programs between my home based imac and my office pc work together. Do i need to load microsoft word onto my imac to make this seamless?

  • Troubleshooting iPhone SDK build 9M2199 beta 7 ...

    I successfully installed the iPhone SDK last night but seem to have a few problems: a) the DOC SET for the "Apple iPhone OS 2.0" does not seem to work, retried several times. b) when trying to follow the "Getting started" tutorial I noticed that the

  • RMI-IIOP Compatability

    We are using weblogic 8.lSP5 and are having trouble rmi-iiop compatability with other containers. Weblogic mangles an exception name like mycompany.exception.FooException as IDL:mycompany/exception/FooEx:1.0. Other containers including websphere and

  • E abnd F fact tables

    I understand that there are 2 fact tables in cube. can u please explain when "E" is created and afterwards whats the role of "F". where the subsequent data goes after transfer to "E". means new data. regards rajesh

  • License Error

    When I try to open any form in SAP B1I get the error msg:"You are not licensed to open form" What does this mean ? and how to solve this problem. Thanx.