Strange behaviour after querying a friendly device name

Hi,
I have observed some very strange behaviour after querying the friendly name of an audio capturing device. This is my code:
#include "stdafx.h"
#include <mmdeviceapi.h>
#include <Functiondiscoverykeys_devpkey.h>
int main(int argc, char *argv[]) {
    HRESULT hr = CoInitializeEx(0, COINIT_APARTMENTTHREADED);
    if(FAILED(hr)) throw;
    IMMDeviceEnumerator *pIMMDeviceEnumerator = 0;
    hr = CoCreateInstance(__uuidof(MMDeviceEnumerator), 0, CLSCTX_INPROC_SERVER, __uuidof(IMMDeviceEnumerator), (LPVOID *) &pIMMDeviceEnumerator);
    if(FAILED(hr)) throw;
    IMMDeviceCollection *pIDeviceCollection = 0;
    hr = pIMMDeviceEnumerator->EnumAudioEndpoints(eCapture, DEVICE_STATE_ACTIVE, &pIDeviceCollection);
    if(FAILED(hr)) throw;
    IMMDevice *pIMMDevice = 0;
    hr = pIDeviceCollection->Item(0, &pIMMDevice);
    if(FAILED(hr)) throw;
    IPropertyStore *pIPropertyStore = 0;
    hr = pIMMDevice->OpenPropertyStore(STGM_READ, &pIPropertyStore);
    if(FAILED(hr)) throw;
    PROPVARIANT propVariant;
    PropVariantInit(&propVariant);
    pIPropertyStore->GetValue(PKEY_Device_FriendlyName, &propVariant);
    PropVariantClear(&propVariant);
    pIPropertyStore->Release();
    pIMMDevice->Release();
    pIDeviceCollection->Release();
    pIMMDeviceEnumerator->Release();
    CoUninitialize();
    return -1;
Please ignore the strange error handling, it's just to make the example code short.
The problem is the return value (as can be seen in the output window of Visual Studio after running the program or using "echo %errorlevel%" in cmd.exe). Certainly, one would expect to get -1. However, I get 0 instead of -1. What makes this
really strange is that -1 is properly returned when the line "pIPropertyStore->GetValue..." is commented out. Why does this have any effect on the return value of the process? I have observed this on two different Window 7 machines with different
soundcard configurations. However, I did another test on a Windows 8.1 machine, where everything worked correctly.
Can anyone explain what's going on here?
Thanks,
Holger

OK, here's what's going on.
Everything goes fine until main() exits.
At that point, mmdevapi.dll's DllMain is called with lpReserved set to a non-NULL value, which is to say, "don't bother to clean up."
mmdevapi.dll decides to clean up anyway (for shame) and calls into some SetupAPI.dll functions.
SetupAPI.dll is waiting on a critical section, but at that point ntdll.dll kicks in and says "you know what, the process is shutting down, and this is the last thread, so I can guarantee you this critical section will never be set." ntdll.dll then
terminates the process, and main()'s exit code is lost.
Matthew van Eerde

Similar Messages

  • [solved] AMD Radeon - strange behaviour after mesa-update

    Good afternoon Ladies and Gentlemen,
    This is my first posting, I will try to give as much as detailed information refering to my problem as possible. Please be patient if I ask for solutions which for you all seem easy and logical, I am a Newbie.
    The details: I am running a HP Pavilion 17 " AMD Quadcore laptop, 8gb Ram, Arch Linux 32bit Kernel 3.17.1 XFCE desktop with an AMD Radeon graphic card for about a few weeks now. Everything went fine so far, but last Saturday I did an update via pacman-Syu, the update included a mesa package. All went smooth as ever. Then after a reboot the XFCE desktop had stripes across the laptop screen, the mouse cursor had disappeared, also letters of the icon descriptions and the menus were missing, some strange "hieroglyphics" appeared instead of them. I wasn't able to downgrade the mesa-package as I nearly wasn't able to open the terminal because of the missing mouse cursor, then I managed somehow to get into the terminal and gave in the commands but the writing was incomplete and/or did not work because of these strange and missing letters.
    No problem, I thought to myself, a fresh install will do the work, so I wipped my hard drive using Parted Magic, then I did a fresh Arch install (Netinstall), this time using LXDE instead of XFCE as my desktop environment. When I booted into the login screen first, it looked fine but after logging into the desktop all the stripes, the missing mouse cursor and the strange letters appeared again. So is there any solution to that strange behaviour ? Before the Saturday-update everything worked without any problems for weeks. BTW other OS work without these problems, I tried Macpup just for fun, no messing-up with my Radeon graphics card happened.
    Sorry for my piss poor English I am Austrian. Sorry for eventually causing any inconvenience asking this question. Regards, Fladi.
    Last edited by fladi (2014-11-04 05:01:28)

    fafik1234 wrote:
    I have the same problem, free drivers, xfce4, procesor AMD5350(Kabini), vga radeon R3 (8400)
    downgrade linux kernel to linux-3.16.4
    download: http://seblu.net/a/arm/packages/l/linux … pkg.tar.xz
    pacma -U linux-3.16.4-1-i686.pkg.tar.xz
    edit /etc/pacman.conf
    IgnorePkg   =  linux linux-headers
    screenshot
    linux 3.17 xfce http://pics.tinypic.pl/i/00592/ek3z3ip81ky2.png
    linux 3.17 compiz http://pics.tinypic.pl/i/00592/bddprwn4tey8.png
    linux 3.16 compiz http://pics.tinypic.pl/i/00592/ja5ma8c7rdgl.png
    On a laptop, free drivers, linux 3.17.1-pae, openbox, procesor core i5, vga integrated card - everything OK
    The screenshots you posted match exactly to my problem ! Are you really sure the bug is coming from Kernel 3.17 ? I had this kernel running for about a week without any problems, the problems came when updating mesa.

  • Strange Behaviour after re-installing the OS

    Hi people.
    Basically, i've been experiencing some strange behaviour with Safari since re-installing my OS. I'm running Safari 3.0.4, and i'm on a G4 iBook running 10.4.11.
    Firstly, it's not remembering passwords and user names to a few sites. My homepage is set to a Auto Forum i use daily. Now, when putting your password in you can check a little box that says 'Automatically log me in each time i visit'. I tick the box, when Safari ask's if i want the password to remembered i say yes. log-in as normal. If i then go away from the page and come back to it without quitting Safari, it's asking me to log in again. It remembers my password details etc, but doesn't perform the auto login like it used to. I've reset Safari, cleared Cookies, Cache etc, but to no avail. It's becoming quite annoying!
    Secondly-the scroll bar on the right side of the screen keeps disappearing-and when it does, i can't manually scroll down the pages with the arrow keys either. Any thoughts? If manually moving from site to site, it's ok-it's when i access my bookmarks page and the scrollbar disappears, that it seems to remove it for good. I then have to quit Safari and re-launch it. But then i'm back to square one! If i need the favourites, i'm stuffed!
    Any help appreciated...
    Dan

    Hi!
    Thanks for the reply! I've started to download the update, got Pacifist already so it's just a case of the download finishing. I'm a bit worried though, i ran disk utility earlier and it came up with 2 errors, one of which couldn't be repaired. I hope it's not the HD on it's way out and causing problems as the new HD isn't even a year old yet...
    I get a bold red message when using Disk Utility, which reads:
    "Invalid Leaf record count
    (Should be 2 instead of 46)
    1 Volume could not be repaired"
    I guess i'll give the Safari thing a go, then go for Disk Utility as per the other thread. Don't really want to wipe the HD and do another install-only done one 2 weeks ago!

  • Strange Behaviour after 6.0.2 install

    Hello all,
    This is my first posting to Apple Discussions, so please be kind...
    I recently installed iTunes 6.0.2 via Software Update and noticed strange behaviour while trying to edit a smart playlist. I have a smart playlist set up to select songs between 3 and 5 stars in My Rating, which have not been played in the last four weeks. While trying to edit the star range, I found that I could only select two stars or five stars. If I clicked one star, it changed to two; if I clicked any other number of stars, it changed to five. As a test, I restored the previous iTunes.app from backup and the problem disappeared.
    Anyone have any ideas what might be causing this?
    Thanks,
    Jon

    Hello Web_Diko,
    I'm sorry but I don't know where you can find that package. I take nightly backups of my machine so I just restored the previous version from my backup. Maybe try a search for "iTunes 6.0.1" on Google or on www.apple.com?
    When I mentioned the "privacy thing" I was alluding to the various items about iTunes 6.0.3 "phoning home" with details of what tracks you are playing together with your Apple ID. It doesn't bother me personally, but I think that the complaints are legitimate, because people should be told whenever they install a program that sends information back to the vendor.
    Jon

  • Strange behaviour with query after adding rownum

    Hi,
    We have query which is similar to the one below
    select * from (inner query) where rownum <=25.
    The inner query return only one record but when the entire query is executed we get 2 records and the the second record does not have any data. If we execute the query without the where clause then the query returns only one records. There are many queries similar to the above one and all works fine. The same query works in in all the environment except production. We are using oracle 10g. It seems like a bug. Can somebody help in resolving this issue.
    Thanks,
    Manohar Puttaswamy

    Due to security policies we are not supposed to post the execution plan and the queries. I am extremely sorry for that. We have some workarounds. We have a distinct in the inner query. If we remove distinct and add group by in the query the query is working fine. And also we have an exists clause in the inner query if we replace the exists clause with an in clause then then also the query is executing fine. The main problem i am facing is i am not able to create a testcase.

  • [SOLVED] Strange behaviour of Query-by-Example (QBE) fields

    Hello,
    Jdev 11g TP3.
    We have a QBE-Block with input fields.
    Follwing steps are performed:
    1) Change to find mode: #{bindings.Find.execute}
    2) Enter search criteria into the fields
    3) execute query: #{bindings.Execute.execute}
    4) change to find mode again --> previously entered search criterias are shown --> OK
    5) clear the search criteria in all fields
    6) execute query again
    7) PROBLEM: query is executed with the OLD search criteria again.
    If we change into query mode again, the OLD search criterias are shown again
    (BUT not for ALL fields).
    8) Even wildcards (* or %) doesn't change the situation.
    But it's possible to enter a different (but not empty) search criteria into the field.
    Details:
    =====
    For some of the QBE-Fields the search criteria can be cleared but for some of them not.
    Differences between this fields:
    a) mandatory fields (also part of the key in the view model and NOT NULL in DB) --> criteria can't be cleared
    b) non-mandatory fields (also not part of the view model and NULL-able in DB) --> criteria can be cleared
    I tried to change one of the mandatory fields to non-mandatory and to be not part of the key in the view model but behaviour doesn't change?
    Can anybody confirm this behaviour as bug or is there a mistake on my side?
    BR
    Peter
    Message was edited by:
    hofespet

    Seems to be solved in TP4.
    br
    Peter

  • Strange behaviour after every cold-boot

    I have iMac, 21.5", late 2011.
    OSX Lion 10.7.1
    All other software are up-to-date (including latest Firmware)
    I have noticed that, every morning when I turn on the machine, a series of weird things happen, as followings:
    1/ The start-up screen has a progress bar running like it does updating its firmware
    2/ No WIFI Card installed??
    3/ Pixellated screen, take long time to load up the menu bar on the top
    4/ No Camera?? (photobooth keeps spinning the ball)
    5/ Generally slow
    Here is what I have done:
    1/ Resetting PRAM
    2/ Reset PMU/SMC
    3/ Repair HDD permission
    All of these strange things will disappear with another reboot (?!). So, I have to reboot 2 times to get the machine works properly everytimes.
    Any other idea?

    Hi...
    Try this workaround:
    When booting wait for logonscreen to show before turning on bluetooth devices (keyboard, mouse and trackpad).
    Or just let it sleep
    What you are experiencing is a boot into safe mode.
    Safe boot (otherwise invoked by holding down shift key during boot) will cause issues like you describe.
    It will do a forced filesystems check (grey progressbar) Other things you may see is no sound, no startup items getting loaded, slow graphics etc. etc.
    When rebooting it will boot normaly, hence your issues will be gone.
    More on safe boot:
    http://support.apple.com/kb/HT1564
    It's a (maybe not very) known issue with bluetooth devices and iMac's.
    Please report this issue to Apple. Then maybe it will get fixed in some update.
    http://www.apple.com/feedback/
    Hope this helps
    /Dennis

  • Strange Behaviour after calling Stateless component

    Just like the tittle says, something weird is happening when I call a component this way on attributtes definition
    @EJB
    private MyComponent component;
    then on a method
    BigDecimal var = null;
    try {
         var = component.someMethod(object,somethingMore);
         } catch (Exception e) {
    System.out.println(" Error ");
    At this point, is something which I am doing wrong?
    Well, the strange thing about this, is that the component's method returns a O.K. value (I See It on the log).
    When this value (var) is Zero, the report (the app) works fine.
    When var has a value different to Zero, the reporte crashes, and when I look the log, apparently there is nothing wrong on this component section, but lines down, there is the thin which crashes the app:
    UPDATE over a Database view!!!
    On normal conditions, this update shouldn't happen, it's just a query over a database view, and works correctly when I deactivate the calling of that component, or the result of the component's method is Zero.
    I think, there is something wrong on the component (Mycomponent) querys. But, the method is returning o.k. values, then?
    Thanks in advance.
    Johan T

    Yep. You have a bug somewhere. No need to post about that, you already figured that out. Perhaps you even have two bugs: one in your business logic or a query and one in your error handling code.
    Good luck finding it. Might I suggest learning how to use a debugger? You're going to need on at this point.

  • Strange behaviour after update to 10.4.7

    Soon after updating to 10.4.7 (via Software Update) my MacBooks seems to be defective.
    After updating to 10.4.7 I heard the "whining" for the very first time on my MacBook. It cames from the area of the power supply connector. But that's not my main problem.
    The next morning after the update, my MacBook seems to be dead. I switched my MacBook on, the start up sound was coming, but the screen remains white and shows no Apple logo. After 30 seconds a lot of vertical lines occurs on the screen. Nothing more happens.
    After I checked some possible sources, e.g. the memory modules, I found out that reseting the PRAM seems to fix my problem: The MacBook was booting and working w/o any failures. Unfortunately, only temporarily.
    As I restarted the MacBook after some time, the same problem occurs
    Any ideas before I bring in the MacBook to service?
    Regards,
    Tom
    MacBook in black

    Missing files? Well the combo is exactly that, a
    combination of all previous updates and security
    updates. I think it's a misguided belief people have
    that the Delta may be missing certain essential
    files. Based on that theory you shouldn't use
    Software Update at all for any updates.
    AppleTalker, normally I'd agree with you on this (never had any problem using Software Update), but in the case of 10.4.7 it looks like Apple actually forgot some files in the Delta (i.e.Software Update) they originally posted:
    http://www.macfixit.com/article.php?story=20060705002510509
    More on the Intel re-release and build numbers We previously noted that Apple re-released the Mac OS X 10.4.7 updater for Intel-based Macs due to the omission of some files related to OpenGL performance.
    According to Apple, the omission only affected the delta (smaller, version-to-version) update, with the combo updater apparently carrying the OpenGL-related files all along. In other words, if you initially applied the combo updater, you do not need to download any additional files.

  • Strange Behaviour of Query. Any Inputs?

    I have a query as follows:
    select t1.col1 from table1 t1 where t1.col2=(
    select t2.col1 from table2 t2 where t2.col2=(
    select t3.col1 from table3 t3 where t3.col2=somevalue));
    When executed, it gives me the expected results. But when I execute the subquery alone as
    select t2.col1 from table2 t2 where t2.col2=(
    select t3.col1 from table3 t3 where t3.col2=somevalue);
    it gives me the error as invalid column.
    How does the main query give me the correct results when the subquery gives an error? Can anyone explain this?
    Thanks in advance?

    Hello,
    Please write your actual query here, as I created such type of query and it is working fine here.
    Adi

  • Stacked 2D Column chart - strange behaviour after upgrade to 3.1.1.

    Problem is, when I choose chart type Stacked 2D Column, I get values on columns (I want just hints). 3.1 version works fine, and after upgrade to 3.1.1, values starts to apper on columns (show_values checkbox is disabled).
    Interesting is, that Stacked 3D column works fine, and values dont apper.
    Any idea, please?
    Kreso...

    Christopher,
    There is a workaround for this issue, but since we received the new flash file from AnyChart to fix in 3.1.2, please upgrade to 3.1.2 when it becomes available. To workaround in 3.1.1:
    1. Download and unzip the 3.1 installation medium.
    2. Find the /images/flashchart directory where the 3.1.1 images reside.
    3. Replace the 3.1.1 version of /images/flashchart/Stacked2DColumn.swf with
    the 3.1 version of the file from step 1.
    4. If using the PL/SQL Gateway (EPG), run apxldimg.sql to reload the 3.1.1 /images files into the database.
    - Christina

  • How to delete duplicates in oracle 10g ( strange behaviour)

    Recently we migrated from oracel 8i to oralce 10g and we face this problem.
    When we try to delete duplicates using rowid ( analytical functions row_number()/
    or normal delete ) and commit the same , still we find some duplicates to be existing because of which we are not able to enable costriants and resulting in process failure.
    When we run the same delete statement next time it removes more duplicates than the required or sometimes required duplicates resulting in abnormal behaviour.
    I don not understand this strange behaviour after upgrading to oracle 10g.
    It'd be great if some one who has idea on this can throw light on the same.
    thanks

    Gasparotto,
    Thanks a lot for letting me know a new procedure to delete duplicates sing lead function.
    I've tried this code on a temp table and it worked, let me use the same query on the prodn side and test the same.
    Procedure for deletion of duplicates using lead analytical function.
    create table temp ( col1 number(2) , col2 number(2) , col3 number(2));
    insert into temp values ( 1,2,10);
    insert into temp values ( 1,2,20);
    insert into temp values ( 1,2,30);
    insert into temp values ( 3,2,10);
    insert into temp values ( 3,4,12);
    insert into temp values ( 3,4,45);
    commit;
    COL1 COL2 COL3
    1 2 10
    1 2 20
    1 2 30
    3 2 10
    3 4 12
    3 4 45
    select col1,col2 , col3, LEAD(rowid) OVER (PARTITION BY col1,col2 order by null) from temp;
    COL1 COL2 COL3 LEAD(ROWID)OVER(PA
    1 2 10 AAAVBjAApAAAFyGAAB
    1 2 20 AAAVBjAApAAAFyGAAC
    1 2 30
    3 2 10
    3 4 12 AAAVBjAApAAAFyGAAF
    3 4 45
    6 rows selected.
    select rowid , temp.* from temp ;
    ROWID COL1 COL2 COL3
    AAAVBjAApAAAFyGAAA 1 2 10
    AAAVBjAApAAAFyGAAB 1 2 20
    AAAVBjAApAAAFyGAAC 1 2 30
    AAAVBjAApAAAFyGAAD 3 2 10
    AAAVBjAApAAAFyGAAE 3 4 12
    AAAVBjAApAAAFyGAAF 3 4 45
    SQL> DELETE temp
    WHERE rowid IN
    ( SELECT LEAD(rowid) OVER (PARTITION BY col1, col2 ORDER BY null)
    FROM temp ); 2 3 4
    3 rows deleted.
    SQL> select rowid , temp.* from temp ;
    ROWID COL1 COL2 COL3
    AAAVBjAApAAAFyGAAA 1 2 10
    AAAVBjAApAAAFyGAAD 3 2 10
    AAAVBjAApAAAFyGAAE 3 4 12
    Thanks for the reply

  • Hello, I have a iPod touch 4g,last time when I paired with my friends iPhone it showed his iPhone's name along with devices connected earlier in the bluetooth list after I updated my software to ios 5.1 the names of friends devices appear as D1:FG:12:13..

    Hello,
    I have a iPod touch 4g,last time when I paired with my friends iPhone it showed his iPhone's name along with devices connected earlier in the bluetooth list after I updated my software to ios 5.1 the names of friends devices appear as D1:FG:12:13:AK something like that and all the other previously connected devices appear in this same form in the bluetooth list how do I fix this back and it is confusing to connect to a device with no name but some unknown Bluetooth address so how do I find the device name back????
    SO PLEAZZZZZ HELP!!!!!

    An iPod can only pair with an iPhone for internet sharing provided that the iPhone has the subscribed to the tethering plan. The BT profiles do not permit file tansfer between IDevices by BT. The only BT pairsin is by app and those ar for peer-to-peer gaming.

  • Changed (renamed) device name in Intune app on iOS device. This change is not showing up in the admin portal, even after 24 hours

    Hi,
    I am trying to update a mobile devices names.  Initially, I changed the iOS device name (Settings->General->About->Name) and then I also renamed the device in the Intune app on the device.  Neither of these changes are propagating through
    to the admin portal, even after 24 hours.  Is there anything else I should be doing for this to work?
    Thanks in advance for your help.
    Simon.

    I'm seeing the same thing as Simon, I changed the iOS device name in both places on an iOS device and the name in the Intune console is still "iPhone" which is really unhelpful as I'm sure you can imagine.  Is there some other place
    that we should be going to rename devices so they are more easily identifiable in the Intune console?
    Thanks!

  • Tecra 8000: Strange keyboard behaviour after reassembling

    Hi,
    after reassembling the single keys to my keyboard from Tecra 8000 the keys have a strange behaviour. For example if i press the key 2 the display shows '82' or 'q'. if i hold the key longer, the display shows '2222222222222....', the right sign for the key.
    Do you knwo, what i can do?
    i had to reassemble the key because my little niece took all the keys off.
    thanks for your answer,
    Butch

    Hi
    I agree with Daniel. There is some technical problem and only thing you can do is try to clean the contacts. If there is no success you should replace the keyboard. This unit is older one and I am pretty sure that you can find a cheap used keyboard.
    Bye

Maybe you are looking for

  • Unable to populate list items with criteria

    Hi I want to populate some values based on condition in a text field. I tried the code wihtout condition in new form instance and its working fine but when i tried with an condition on when mouse click on list item and its working for first action.If

  • How to Integrate DERBY Database to XI?

    I am tying to store an XML format data recieved from a web service to Derby Database of Netbeans Studio. Is this possible then which XI adapter should I use in the Communication channel configuration? Any help will be great?

  • Credit limit in Percentage

    hi all , can we define credit limit in % for example , i have on automatic credti checy with 0 value default I have advance customer .. can i define 30 % advance in credit limit ..mean if the customer has not payed 30 % of the total sale order value

  • MSEG - Recommended maximum number of records?

    Hi all, This is probably an oldie but a goodie.... does anyone know if SAP has a recommended maximum number of entries for table MSEG? I've got around 43 million entries and have terrible performance on MB51 reports and custom reports hitting this ta

  • Kernel Panic - mac crash

    Hi, my MBP crashed 3 times this week. First I didn't read the problem details. The other/last two which happened last night an this morning mentioned Kernel panic. (Copied all the details down in case that's of any help?) I read the following in an o