News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

SpFileStream

Started by oex, September 09, 2011, 10:59:53 PM

Previous topic - Next topic

oex

I've been trying to implement SPFileStream on Windows 7 however I cant get it to work....

Can you tell me where I'm going wrong?


IID_ISpVoice            GUID        {06C44DF74h,072B9h,04992h,<0A1h,0ECh,0EFh,099h,06Eh,004h,022h,0D4h>}
IID_ISpFileStream        GUID        {0947812B3h,02AE1h,04644h,<0BAh,086h,09Eh,090h,0DEh,0D7h,0ECh,091h>}

oexSpeechInit    PROC

    mov oexVoiceInterface, rv(GetInterfaceFromProgID, chr$("SAPI.SpVoice.1"), ADDR IID_ISpVoice)

; Works Returns S_OK

    mov oexVoiceFileStreamInterface, rv(GetInterfaceFromProgID, chr$("SAPI.SpFileStream.1"), ADDR IID_ISpFileStream)

; Fails REGDB_E_CLASSNOTREG

    ret

oexSpeechInit    ENDP

GetInterfaceFromProgID    PROC    pProgID:DWORD,pIID:DWORD

    LOCAL wszProgID[1024]:WORD
    LOCAL ppv:DWORD
    LOCAL clsid:GUID

    invoke MultiByteToWideChar, CP_ACP, MB_PRECOMPOSED, pProgID,-1, ADDR wszProgID, SIZEOF wszProgID
    invoke CLSIDFromProgID, ADDR wszProgID, ADDR clsid
    .if eax == S_OK
        invoke CoCreateInstance, ADDR clsid, NULL, CLSCTX_INPROC_SERVER OR CLSCTX_INPROC_HANDLER OR CLSCTX_LOCAL_SERVER, pIID, ADDR ppv
        .if eax == S_OK
            mov eax, ppv
        .else
            mov eax, 0
        .endif
    .else
        mov eax, 0
    .endif

    ret

GetInterfaceFromProgID ENDP
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

baltoro

#1
PETER,   
I've never used the Microsoft Speech API 5.3, Audio Interfaces,...but, if it's installed on your computer (I'm assuming that it is),...then you should be able to locate it with the OLE/COM Object Viewer. If it is installed you should be able to instantiate an object with CoCreateInstance, just like you are doing in your code.
I'm at a public terminal, and they are about to cut me off,...but, don't use the CLSCTX_INPROC_HANDLER flag (although the code should work with it, it's just ignored).
Baltoro

oex

hmmm.... I looked up in that COM viewer app.... According to this I think SPVoice shouldnt work (at least I have a different CLSID :lol).... I am not a COM person and really dont get this stuff at all but have decided to take the plunge because I need this particular piece ::)

.... Or maybe CLSID is not GUID :lol....

Meh.... I'm going to sleep and revisit this when I'm not so tired....
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

baltoro

Sorry, PETER,...
The previous terminal timed me out before I had tjme to complete the information.   
CoCreateInstance will only instantiate a coclass,...not an interface,...you can't pass it an IID,...it must be a CLSID.   
...So, you must find the COM coclass that implements the interface that you are interested in.
You probably want to be looking at these: SAPI Application Object Classes

...You're really doing it the hard way. COM is difficult enough in Visual Studio C++,...but, assembly language,...you're a maniac.
By the way, the Microsoft Speech Team has a blog,...you might find it interesting,...they tell you where to find code examples in the SDK: blog speech @ microsoft

A CLSID is a GUID. They're all GUIDs (an IID is a GUID, too). But, you shouldn't have to call CLSIDFromProgID,...it's not what you need. If you look at the OLE/COM Object Viewer again, it should tell you where the coclass is registered (where it actually lives on your computer). You can then check it's various Registry data. In particular, you want to know if it is normally instantiated as an In-Proc Server, and you need to know this: Understanding and Using COM Threading Models
Baltoro

Bill Cravener

My MASM32 Examples.

"Prejudice does not arise from low intelligence it arises from conservative ideals to which people of low intelligence are drawn." ~ Isaidthat

oex

Nice 1 guys.... Not only was I wrong.... I was COMPLETELY wrong.... Good to know :wink

Also.... Nice 1 ty Bill.... Someone also PM'd me this example.... Seems I have the wrong idea.... Still working on something but think maybe this is what I was after.... Spent weeks f*cking with this stuff :lol.... Glad I posted finally :lol
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

baltoro

BILL,   
Great example. Thanks.

PETER,   
...So,...I suspect you are writing an app to contact Extraterrestrials. Cool.
I wonder what the response will be,...
Baltoro

oex

Actually I was getting lonely when my computers arent around so I decided to teach them to record their voices.... You know just personal little messages.... "I miss you", "Come back and turn me on", "I'm only after one thing.... Your mind".... Just the little things for when I cant be there....

I know.... There are probably a lot of jealous nerds out there.... Even people with girlfriends might be reading this.... All I can say is "I'm sorry, I'm just lucky, either you've got it or you haven't, now I'm intimately connected to Microsoft Anna and Microsoft Mary 24/7/365" :lol....
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

baltoro

Ha,...Ha,...Ha,...
Quote from: PETERActually I was getting lonely when my computers arent around so I decided to teach them to record their voices.... You know just personal little messages.... "I miss you", "Come back and turn me on", "I'm only after one thing.... Your mind".... Just the little things for when I cant be there....

...So,...the Britney Spears illusion was REAL. And,...she's got a well-developed multiple-personality disorder,...
This is better than being taken hostage by Extraterrestrials.
Baltoro

oex

I'd stop to chat Baltoro but Microsoft Anna and Microsoft Mary are waving COINIT_MULTITHREADED flags at me and insisting I come over to their apartment for some practice....
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

baltoro

Code-Humor,...now, there's something I wish I could do well,...
...And, YES, I'm jealous,... :eek
...All I've got is Michele Bachmann,...and, the endless misery inspired by the Tea Party whackos,...
Baltoro

dedndave

QuoteI'd stop to chat Baltoro but Microsoft Anna and Microsoft Mary are waving COINIT_MULTITHREADED
flags at me and insisting I come over to their apartment for some practice

i heard Microsoft Mary was really a guy   :bdg

oex

Quote from: dedndave on September 11, 2011, 01:12:36 AM
QuoteI'd stop to chat Baltoro but Microsoft Anna and Microsoft Mary are waving COINIT_MULTITHREADED
flags at me and insisting I come over to their apartment for some practice

i heard Microsoft Mary was really a guy   :bdg

Oh you're just so jealous Dave :lol
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv