Problem with Pseudotypes

Windows specific forum
Salc
User
User
Posts: 11
Joined: Tue Sep 25, 2012 9:20 am

Problem with Pseudotypes

Post by Salc »

Hi,

I'm playing a bit with pseudotypes but there's something I'm not sure with..

Here's a short DirectShow-code that plays some audiofile:

Code: Select all

; 5.10 x86 Ascii   -> working
; 5.10 x86 Unicode -> working
; 5.10 x64 Ascii   -> working
; 5.10 x64 Unicode -> working

; 5.11 x86 Ascii   -> working
; 5.11 x86 Unicode -> working
; 5.11 x64 Ascii   -> crashes  <---------
; 5.11 x64 Unicode -> working

Interface IGraphBuilder_u
  QueryInterface(a, b)
  AddRef()
  Release()
  AddFilter(a, b)
  RemoveFilter(a)
  EnumFilters(a)
  FindFilterByName(a.p-unicode, b)
  ConnectDirect(a, b, c)
  Reconnect(a)
  Disconnect(a)
  SetDefaultSyncSource()
  Connect(a, b)
  Render(a)
  ;RenderFile(a, b)
  RenderFile(a.p-unicode, b)
  AddSourceFilter(a, b, c)
  SetLogFile(a)
  Abort()
  ShouldOperationContinue()
EndInterface


Global IID_IGraphBuilder.GUID
With IID_IGraphBuilder
  \Data1    = $56A868A9
  \Data2    = $0AD4
  \Data3    = $11CE
  \Data4[0] = $B0
  \Data4[1] = $3A
  \Data4[2] = $00
  \Data4[3] = $20
  \Data4[4] = $AF
  \Data4[5] = $0B
  \Data4[6] = $A7
  \Data4[7] = $70
EndWith

Global CLSID_FilterGraph.GUID
With CLSID_FilterGraph
  \Data1    = $E436EBB3
  \Data2    = $524F
  \Data3    = $11CE
  \Data4[0] = $9F
  \Data4[1] = $53
  \Data4[2] = $00
  \Data4[3] = $20
  \Data4[4] = $AF
  \Data4[5] = $0B
  \Data4[6] = $A7
  \Data4[7] = $70
EndWith
  
Global IID_IMediaControl.GUID
With IID_IMediaControl
  \Data1    = $56A868B1
  \Data2    = $0AD4
  \Data3    = $11CE
  \Data4[0] = $B0
  \Data4[1] = $3A
  \Data4[2] = $00
  \Data4[3] = $20
  \Data4[4] = $AF
  \Data4[5] = $0B
  \Data4[6] = $A7
  \Data4[7] = $70
EndWith

CoInitializeEx_(0, $02)

;Define GraphBuilder.IGraphBuilder
Define GraphBuilder.IGraphBuilder_u
Define MediaControl.IMediaControl

Filename.s = "PATH_TO_AUDIO_FILE"  

If CoCreateInstance_(@CLSID_FilterGraph, #Null, $01, @IID_IGraphBuilder, @GraphBuilder) = #S_OK
  Debug "GraphBuilder created"
  If GraphBuilder\QueryInterface(@IID_IMediaControl, @MediaControl) = #S_OK
    Debug "MediaControl created"
    ;If GraphBuilder\RenderFile(@Filename, #Null) = #S_OK
    If GraphBuilder\RenderFile(Filename, #Null) = #S_OK
      Debug "File rendered"
      MediaControl\Run()
      Debug "File playing"
      Repeat
        Delay(10)
      Until GetAsyncKeyState_(#VK_ESCAPE)&$1
      MediaControl\Stop()
      CoUninitialize_()
    EndIf
  EndIf
EndIf
(Insert the Path to an audiofile. You need the right DirectShow Filters, so the best is to use an wav-file.)

I've inserted my own copy of the Interface IGraphBuilder and replaced 'RenderFile(a, b)' with 'RenderFile(a.p-unicode, b)'.
This is working perfect with PB 5.10 x86 and x64, both Ascii- and Unicodemode.
But with PB 5.11 x64 Ascii the code crashes.
If I'm using the original Interface and poking the string to memory with unicode-flag, everything is working.

Is there an error in my usage with pseudotypes or is it a bug in PB 5.11?

I've tested this with PB 5.10 and 5.11, x86 and x64 on Windows 7.

Salc