• The Archives
  • 64 bit MFX and DXi development: Where do I start? (p.3)
2013/08/21 09:57:57
Markleford
More guesses from Frank:
 
"Well, I can not tell if VS Express is sufficient. I use VS Ultimate for the development."
 
So I suppose I'll have to still determine if I have to upgrade.
 
"Registering the plugins is straightforward. What I do for development purpose: regsvr32 /s DeleteDoubles\x64\Release\DelDoubl.dll"
 
So nothing special there.
 
"I do not link any DirectX libraries or include any. This is not necessary.
There is an old MFX_wizard in Cakewalk's SDK. Use this one for midi plugins; then no DirextX libs are required."
 
I actually think that my plugins are based off the MFX_wizard code. In fact, I wrote my own wizard to put in my own basic framework that I use for everything, so perhaps that is my problem!
 
This topic has been downgraded on my priority list, so I haven't been working actively on it. And @b_rock, I guess we can give that poly-aftertouch idea a try if I manage to get it working again!
 
Best,
- m
2013/08/23 13:53:29
colinjamieson
I fired up a pile of virtual machines and I made some progress using the sample projects from the sdk. There are two projects related to MFX, one using MFC, and the other using the raw win32 API. There is also the wizard Markleford mentioned, but I haven't dived into that yet.
 
I replicated all 32-bit steps in both VS 2008 Pro and VS 2010 Pro.
From project manager, I delete the .hpj file and the entire help directory. Once this is done, I can get a 32-bit build without errors (but with tons of warnings). With one exception, the dlls register, and are visible in 32-bit Sonar. Oddly, with the MFC project, the debug dll produced by VS 2010 fails to register, even though the release dll works just fine. All dlls produced by VS 2008 worked without issue.
 
I attempted a 64-bit build of the win32 API project in VS 2010 (my 2008 environment wasn't configured to handle 64-bit builds.) I was alerted to a couple errors that were fixed by using non-deprecated versions of api methods and constants. Once this was done, the build was about as clean as the 32-bit one (still lots of warnings about deprecated str copy methods). I was able to register the 64-bit dll using regsvr32 as always, however, the plugins would not appear in Sonar X2. I went digging in the registry, and found that the dll registration was only partially complete. It was missing a required entry under Cakewalk.
 
If I can get the plugin working by manually adding the missing registry entries, then I'll take a closer look at the registration code in the project tonight.
 
Thank you again Markleford for your input and consultation with Frank. It gave me hope that this might actually be possible and that the solution might be something straight forward.
2013/08/24 00:52:34
colinjamieson
When I manually populate the registry, the 64-bit plugin becomes available in 64-bit Sonar. Obviously something is broken in the project code for registering the control via regsvr32. Unfortunately, even though I can add it to the FX chain on a MIDI channel, I can't get the plugin GUI to appear. I guess I need to start cleaning up the warnings in the project build. I'm definitely much closer now than I ever managed to get back in February.
2013/08/24 00:52:42
colinjamieson
When I manually populate the registry, the 64-bit plugin becomes available in 64-bit Sonar. Obviously something is broken in the project code for registering the control via regsvr32. Unfortunately, even though I can add it to the FX chain on a MIDI channel, I can't get the plugin GUI to appear. I guess I need to start cleaning up the warnings in the project build. I'm definitely much closer now than I ever managed to get back in February.
2013/08/24 10:39:44
Markleford
That's progress, at least! Great to hear!
2013/08/25 03:53:16
colinjamieson
Problem sufficiently solved!
 
I figured out why the plugin GUI wasn't appearing. As those of you who have created your plugins probably already knew, there are two GUIDs that need to be added to the registry - not one. If I manually populate all required registry entries, the plugin works.
 
So, I was left with trying to figure out why regsvr32 is failing to actually register the dll, even though it reports success on completion. I learned something new today - how to examine a dll in debug mode while regsvr32 is executing. In function setKeyAndValue, I found that the result from RegCreateKeyEx was ERROR_ACCESS_DENIED. Also, function DllRegisterServer (which is called by regsvr32) returns S_OK no matter what happens - thus the outcome of regsvr32 always reporting success even when it fails.
 
Much online searching suggests that the crux of the registry issue has nothing to do with 64-bit, and everything to do with how Windows changed its registry editing access requirements starting with Windows Vista (I'm running Windows 7).
 
I have a working, but not so satisfying solution. First, I took Markleford's lead from his Ten Crazy deployments, and used a .bat to call regsvr32. It worked fine in all Windows XP 32-bit scenarios. Even under Windows 7, I get a success message, but as mentioned above, it's deceptive. Next, I tried right clicking the .bat and selecting Run As Administrator. Unfortunately, when you do this, the working directory changes from being whatever folder the .bat and .dll are in to being c:\windows\system32, and then it complains that it can't find the .dll. My solution for now is to reference the .dll with a static path inside the .bat. This is the unsatisfying part - it works, but the .bat needs to be edited if you want to put the .dll in a different directory, and you need to explicitly "run as administrator."
 
So, the sufficiently final solution to get everything working in the two sdk projects "MFCSample MFX" and "Sample MFX":
(these directions might be a bit specific to the sdk projects, but hopefully this will be helpful to anyone running into trouble with their own projects) 
  1. Open the solution in Visual Studio 2010 Professional (I welcome someone else to try this with the Express Version)
  2. Agree to convert the project from Visual c++ 6.0 format to VS 2010 format.
  3. Agree to permanently remove version control  bindings
  4. If you want to preserve your help system, you'll have to convert it to something more modern - good luck. Otherwise: from Solution Explorer delete:
    1. the .hpj file
    2. the entire Help Files directory
  5. Within the solution, select the project, and use the Configuration Manager to change the Active solution platform from win32 to x64.
  6. You'll now have to fix any broken deprecated items. For both projects, I only found errors in the Property Page code, but the errors were different in the two projects.
    1. MFCSample MFX: In files MFCSamplePropPage.h and MFCSamplePropPage.cpp, the return type of the callback function DialogProc needs to be changed from BOOL to INT_PTR.
    2. In Sample MFX: In file PropPage.cpp, function CPropPage::StaticDialogProc, change:
      1. SetWindowLong to SetWindowLongPtr
      2. GetWindowLong to GetWindowLongPtr
      3. The two instances of DWL_USER to DWLP_USER
  7. Rebuild and ignore the warnings if you dare. Almost all of the warnings have to do with string copy and concatenation functions. The deprecated versions have no bounds checking and allow buffer overflows, whereas the new versions perform bounds checks. However, when has a buffer overflow ever caused any trouble... :) points finger at the Morris Worm
  8. The sdk projects are configured to automatically register the dlls. However, the registration will fail due to the permissions issue.
  9. copy the .dll from the debug or release folder (as the case may be) and stick it in C:\Program Files\Cakewalk\Shared MIDI Plugins\
  10. Create a .bat file in the same directory, and put the following line inside of it (replacing MyPlugin.dll with the actual name of your own plugin):
    1. regsvr32.exe "C:\Program Files\Cakewalk\Shared MIDI Plugins\MyPlugin.dll"
  11. Right-click on the .bat file and select "Run as administrator"
  12. Rock and Roll
If anyone can identify an elegant way to elevate permissions and remove the need for a static path in the .bat, then I'm all ears.
2013/08/25 10:34:22
Markleford
Wow! Excellent detective work! Congrats!
 
NOW... Are you willing to share a working plugin project (just the SDK's Sample MFX is fine) so that I can check if it can compile and register under Express?
 
2013/08/25 14:00:16
colinjamieson
Absolutely. Where's the upload button?
2013/08/25 15:09:12
Markleford
If you can't attach a zip in a Private Message to me, you could always email it to me through the address here: http://www.tencrazy.com/contact/
 
2013/08/25 16:27:25
colinjamieson
I don't have enough street cred on this site to send a private message, so I emailed it to you.
© 2024 APG vNext Commercial Version 5.1

Use My Existing Forum Account

Use My Social Media Account