question

87922048 avatar image
0 Votes"
87922048 asked DoronHolan commented

Can APO use #pragma data_seg?

Hi.
The following page states that the memory must be nonpageable.
https://docs.microsoft.com/ja-jp/windows-hardware/drivers/audio/implementing-audio-processing-objects

Are paged memory and shared memory the same?
Can APO use shared memory (#pragma data_seg) ?

Best regards.

windows-hardwarewindows-hardware-wdk
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

DoronHolan avatar image
0 Votes"
DoronHolan answered DoronHolan commented

Paged memory and shared memory are not the same. The doc page is a little confusing. A user mode DLL cannot normally allocated non paged memory nor mark code as non pageable. In user mode you can use a shared data segment to share memory between processes. The kernel mode driver part of your APO is where you can control non pageable allocations and code. There is only address space for kernel drivers and only one instance of your driver image is loaded, so a shared segment doesn't make sense in kernel mode

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi.Thank you for your answer.
I understand that APO can use #pragma data_seg.

However, data cannot be shared between my APO dll and my exe files.

Do I need any special steps? Or is it the same procedure as a normal dll?
I expect to be able to use #pragma data_seg like a normal dll.

Best regards.

0 Votes 0 ·
DoronHolan avatar image DoronHolan TakayamaShinichi-8826 ·

For your user mode component, it is a DLL and all the normal data segment behaviors still apply. that means a shared data segment will be available in every process that loads the DLL. Note that this design pattern is a huge security hole. Any process can load your DLL and then attack other processes with the shared data.

2 Votes 2 ·