1
0

main.cpp 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. #include "../../Library/ml_pmp/pmp.h"
  2. #include "../Winamp/wa_ipc.h"
  3. #include <vector>
  4. #include "../nu/AutoWide.h"
  5. #include "../nu/AutoChar.h"
  6. #include "../nu/AutoLock.h"
  7. #include "api.h"
  8. #include "resource.h"
  9. #include "usbdevice.h"
  10. #include "deviceprovider.h"
  11. #include <devguid.h>
  12. #include <shlobj.h>
  13. #include <shlwapi.h>
  14. #include <strsafe.h>
  15. #define PLUGIN_VERSION L"1.62"
  16. static int Init();
  17. static void Quit();
  18. static bool doRegisterForDevNotification(void);
  19. static intptr_t MessageProc(int msg, intptr_t param1, intptr_t param2, intptr_t param3);
  20. extern PMPDevicePlugin plugin = {PMPHDR_VER,0,Init,Quit,MessageProc};
  21. bool loading_devices[26] = {0,};
  22. // start-usb
  23. static const wchar_t *winampini;
  24. static std::vector<HANDLE> loadingThreads;
  25. static std::vector<wchar_t*> blacklist;
  26. static HDEVNOTIFY hDevNotify;
  27. std::vector<USBDevice*> devices;
  28. HWND config;
  29. static DeviceProvider *deviceProvider = NULL;
  30. static UINT_PTR rescanTimer = 0;
  31. static void blacklistLoad() {
  32. wchar_t keyname[64] = {0};
  33. int l = GetPrivateProfileIntW(L"pmp_usb", L"blacklistnum", 0, winampini);
  34. for(int i=l>100?l-100:0; i<l; i++) {
  35. wchar_t buf[100] = {0};
  36. StringCchPrintfW(keyname, 64, L"blacklist-%d", i);
  37. GetPrivateProfileStringW(L"pmp_usb", keyname, L"", buf, 100, winampini);
  38. if(buf[0])
  39. {
  40. blacklist.push_back(_wcsdup(buf));
  41. }
  42. }
  43. }
  44. static void blacklistSave() {
  45. wchar_t buf[64] = {0};
  46. StringCchPrintfW(buf, 64, L"%u", blacklist.size());
  47. WritePrivateProfileStringW(L"pmp_usb", L"blacklistnum", buf, winampini);
  48. for(size_t i=0; i<blacklist.size(); i++)
  49. {
  50. StringCchPrintfW(buf, 64, L"blacklist-%u", i);
  51. WritePrivateProfileStringW(L"pmp_usb", buf, (const wchar_t*)blacklist.at(i), winampini);
  52. }
  53. }
  54. static wchar_t *makeBlacklistString(wchar_t drive) {
  55. wchar_t path[4]={drive,L":\\"};
  56. wchar_t name[100]=L"";
  57. wchar_t buf[FIELD_LENGTH]=L"";
  58. DWORD serial=0;
  59. UINT olderrmode=SetErrorMode(SEM_NOOPENFILEERRORBOX | SEM_FAILCRITICALERRORS);
  60. GetVolumeInformation(path,name,100,&serial,NULL,NULL,NULL,0);
  61. if(serial)
  62. {
  63. StringCchPrintf(buf, FIELD_LENGTH, L"s:%d",serial);
  64. SetErrorMode(olderrmode);
  65. return _wcsdup(buf);
  66. }
  67. {
  68. ULARGE_INTEGER tfree={0,}, total={0,}, freeb={0,};
  69. GetDiskFreeSpaceEx(path, &tfree, &total, &freeb);
  70. StringCchPrintf(buf, FIELD_LENGTH, L"n:%s,%d,%d", name, total.HighPart, total.LowPart);
  71. SetErrorMode(olderrmode);
  72. return _wcsdup(buf);
  73. }
  74. }
  75. static bool blacklistCheck(wchar_t drive) {
  76. wchar_t *s = makeBlacklistString(drive);
  77. if (s)
  78. {
  79. for(size_t i=0; i<blacklist.size(); i++)
  80. {
  81. if(!wcscmp(s,(wchar_t*)blacklist.at(i)))
  82. {
  83. free(s);
  84. return true;
  85. }
  86. }
  87. free(s);
  88. }
  89. return false;
  90. }
  91. // helpers
  92. static DWORD WINAPI ThreadFunc_Load(LPVOID lpParam) {
  93. wchar_t drive = (wchar_t)(intptr_t)lpParam;
  94. pmpDeviceLoading load;
  95. Device * d = new USBDevice(drive,&load);
  96. return 0;
  97. }
  98. static Nullsoft::Utility::LockGuard connect_guard;
  99. void connectDrive(wchar_t drive, bool checkSize=true, bool checkBlacklist=true)
  100. {
  101. Nullsoft::Utility::AutoLock connect_lock(connect_guard);
  102. // capitalize
  103. if (drive >= 'a' && drive <= 'z')
  104. drive = drive - 32;
  105. // reject invalid drive letters
  106. if (drive < 'A' || drive > 'Z')
  107. return;
  108. if(checkBlacklist && blacklistCheck(drive)) return;
  109. // if device is taken already ignore
  110. for (std::vector<USBDevice*>::const_iterator e = devices.begin(); e != devices.end(); e++)
  111. {
  112. if ((*e)->drive == drive)
  113. return;
  114. }
  115. if (loading_devices[drive-'A'])
  116. return;
  117. loading_devices[drive-'A'] = true;
  118. wchar_t path[4]=L"x:\\";
  119. path[0]=drive;
  120. if(checkSize)
  121. {
  122. ULARGE_INTEGER total;
  123. if (0 == GetDiskFreeSpaceExW(path, NULL, &total, NULL) ||
  124. total.HighPart == 0 && total.LowPart == 0)
  125. {
  126. loading_devices[drive-'A'] = false;
  127. return;
  128. }
  129. }
  130. // Ignore iPods...
  131. // Check for a "iPod_Control" folder,
  132. // if "iPod_Control" is present just bail and
  133. // let the iPod plugin handle it
  134. const wchar_t iPodDb[] = {drive,L":\\iPod_Control"};
  135. WIN32_FIND_DATA ffd={0};
  136. HANDLE h = FindFirstFile(iPodDb,&ffd);
  137. if (h != INVALID_HANDLE_VALUE)
  138. {
  139. FindClose(h);
  140. if (0 != (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
  141. {
  142. loading_devices[drive-'A'] = false;
  143. return;
  144. }
  145. }
  146. // Ignore androids too, have a specific pulgin to take care of android...
  147. // Check for a "Android" folder,
  148. // if "Android" is present just bail and
  149. // let the pmp_android plugin handle it
  150. const wchar_t androidTopLevelDir[] = {drive,L":\\Android"};
  151. h = FindFirstFile(androidTopLevelDir, &ffd);
  152. if (h != INVALID_HANDLE_VALUE)
  153. {
  154. FindClose(h);
  155. if (0 != (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
  156. {
  157. loading_devices[drive-'A'] = false;
  158. return;
  159. }
  160. }
  161. //not an ipod, not an android
  162. //do we know about the device already? is there a metadata.dat file ?
  163. wchar_t cacheFile[FIELD_LENGTH] = {0};
  164. StringCchPrintf(cacheFile, FIELD_LENGTH, L"%c:\\%s", drive, NDE_CACHE_DAT);
  165. if (!PathFileExists(cacheFile))
  166. {
  167. // new device, never plugged in before
  168. wchar_t drvname[100] = {0}, titleStr[128] = {0};
  169. DWORD serial=0;
  170. GetVolumeInformation(path,drvname,100,&serial,NULL,NULL,NULL,0);
  171. wchar_t buf[1024] = {0};
  172. StringCchPrintf(buf, ARRAYSIZE(buf), WASABI_API_LNGSTRINGW(IDS_REMOVEABLE_DRIVE_DETECTED),
  173. drvname, towupper(drive));
  174. if(MessageBox(plugin.hwndLibraryParent,buf,
  175. WASABI_API_LNGSTRINGW_BUF(IDS_WINAMP_PMP_SUPPORT,titleStr,128),
  176. MB_YESNO|MB_SETFOREGROUND|MB_SYSTEMMODAL|MB_TOPMOST) == IDNO)
  177. {
  178. wchar_t * bstr = makeBlacklistString(drive);
  179. loading_devices[drive-'A'] = false;
  180. if (bstr)
  181. {
  182. blacklist.push_back(bstr);
  183. blacklistSave();
  184. }
  185. return;
  186. }
  187. }
  188. DWORD dwThreadId;
  189. HANDLE loadingThread = CreateThread(NULL, 0, ThreadFunc_Load, (LPVOID)(intptr_t)drive, 0, &dwThreadId);
  190. if(NULL != loadingThread)
  191. loadingThreads.push_back(loadingThread);
  192. else
  193. loading_devices[drive-'A'] = false;
  194. }
  195. static void autoDetectCallback(wchar_t drive,UINT type) {
  196. if(type == DRIVE_REMOVABLE)
  197. {
  198. connectDrive(drive,true,true);
  199. }
  200. }
  201. // end-usb
  202. static int Init()
  203. {
  204. WasabiInit();
  205. // start-usb
  206. winampini = (const wchar_t*)SendMessage(plugin.hwndWinampParent,WM_WA_IPC,0,IPC_GETINIFILEW);
  207. // need to have this initialised before we try to do anything with localisation features
  208. WASABI_API_START_LANG(plugin.hDllInstance,PmpUSBLangGUID);
  209. // end-usb
  210. static wchar_t szDescription[256];
  211. StringCchPrintfW(szDescription, ARRAYSIZE(szDescription),
  212. WASABI_API_LNGSTRINGW(IDS_NULLSOFT_USB_DEVICE_PLUGIN), PLUGIN_VERSION);
  213. plugin.description = szDescription;
  214. /** load up the backlist */
  215. blacklistLoad();
  216. if (NULL != AGAVE_API_DEVICEMANAGER &&
  217. NULL == deviceProvider)
  218. {
  219. if (SUCCEEDED(DeviceProvider::CreateInstance(&deviceProvider)) &&
  220. FAILED(deviceProvider->Register(AGAVE_API_DEVICEMANAGER)))
  221. {
  222. deviceProvider->Release();
  223. deviceProvider = NULL;
  224. }
  225. }
  226. /* Our device shows up as a normal drive */
  227. if (NULL == deviceProvider ||
  228. FAILED(deviceProvider->BeginDiscovery(AGAVE_API_DEVICEMANAGER)))
  229. {
  230. SendMessage(plugin.hwndPortablesParent,WM_PMP_IPC,(WPARAM)autoDetectCallback,PMP_IPC_ENUM_ACTIVE_DRIVES);
  231. }
  232. return 0;
  233. }
  234. static void Quit()
  235. {
  236. if (NULL != deviceProvider)
  237. {
  238. deviceProvider->Unregister();
  239. deviceProvider->Release();
  240. deviceProvider = NULL;
  241. }
  242. WasabiQuit();
  243. UnregisterDeviceNotification(hDevNotify);
  244. USBDevice::CloseDatabase();
  245. }
  246. static wchar_t FirstDriveFromMask(ULONG *unitmask) {
  247. char i;
  248. ULONG adj = 0x1, mask = *unitmask;
  249. for(i=0; i<26; ++i) {
  250. if(mask & 0x1) {
  251. *unitmask -= adj;
  252. break;
  253. }
  254. adj = adj << 1;
  255. mask = mask >> 1;
  256. }
  257. return (i+L'A');
  258. }
  259. static int GetNumberOfDrivesFromMask(ULONG unitmask) {
  260. int count = 0;
  261. for(int i=0; i<26; ++i)
  262. {
  263. if(unitmask & 0x1)
  264. count++;
  265. unitmask = unitmask >> 1;
  266. }
  267. return count;
  268. }
  269. static void CALLBACK RescanOnTimer(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
  270. {
  271. KillTimer(hwnd, idEvent);
  272. if (idEvent == rescanTimer)
  273. rescanTimer = 0;
  274. if (NULL == deviceProvider ||
  275. FAILED(deviceProvider->BeginDiscovery(AGAVE_API_DEVICEMANAGER)))
  276. {
  277. PostMessage(plugin.hwndPortablesParent,WM_PMP_IPC,(WPARAM)autoDetectCallback,PMP_IPC_ENUM_ACTIVE_DRIVES);
  278. }
  279. }
  280. int wmDeviceChange(WPARAM wParam, LPARAM lParam)
  281. {
  282. UINT olderrmode=SetErrorMode(SEM_NOOPENFILEERRORBOX|SEM_FAILCRITICALERRORS);
  283. if(wParam==DBT_DEVICEARRIVAL || wParam==DBT_DEVICEREMOVECOMPLETE)
  284. { // something has been inserted or removed
  285. PDEV_BROADCAST_HDR lpdb = (PDEV_BROADCAST_HDR)lParam;
  286. if(lpdb->dbch_devicetype == DBT_DEVTYP_VOLUME)
  287. { // its a volume
  288. PDEV_BROADCAST_VOLUME lpdbv = (PDEV_BROADCAST_VOLUME)lpdb;
  289. if((!(lpdbv->dbcv_flags & DBTF_MEDIA) && !(lpdbv->dbcv_flags & DBTF_NET)))
  290. { // its not a network drive or a CD/floppy, game on!
  291. ULONG dbcv_unitmask = lpdbv->dbcv_unitmask;
  292. // see just how many drives have been flagged on the action
  293. // eg one usb drive could have multiple partitions that we handle
  294. int count = GetNumberOfDrivesFromMask(dbcv_unitmask);
  295. for(int j = 0; j < count; j++)
  296. {
  297. wchar_t drive = FirstDriveFromMask(&dbcv_unitmask);
  298. if((wParam == DBT_DEVICEARRIVAL) && !blacklistCheck(drive))
  299. { // connected
  300. connectDrive(drive);
  301. //send a message as if the user just selected a drive from the combo box, this way the fields are refreshed to the correct device's settings
  302. SendMessage(config, WM_COMMAND,MAKEWPARAM(IDC_DRIVESELECT,CBN_SELCHANGE),0);
  303. }
  304. else
  305. { // removal
  306. for(size_t i=0; i < devices.size(); i++) {
  307. USBDevice * d = (USBDevice*)devices.at(i);
  308. if(d->drive == drive)
  309. {
  310. devices.erase(devices.begin() + i);
  311. if(config) SendMessage(config,WM_USER,0,0); //refresh fields
  312. if(config) SendMessage(config,WM_COMMAND, MAKEWPARAM(IDC_DRIVESELECT,CBN_SELCHANGE),0); //update to correct device change as if the user had clicked on the combo box themself
  313. SendMessage(plugin.hwndPortablesParent,WM_PMP_IPC,(intptr_t)d,PMP_IPC_DEVICEDISCONNECTED);
  314. delete d;
  315. }
  316. }
  317. }
  318. }
  319. }
  320. }
  321. }
  322. else
  323. {
  324. rescanTimer = SetTimer(NULL, rescanTimer, 10000, RescanOnTimer);
  325. }
  326. SetErrorMode(olderrmode);
  327. return 0;
  328. }
  329. static int IsDriveConnectedToPMP(wchar_t drive) {
  330. for(size_t i = 0; i < devices.size(); i++)
  331. {
  332. if(((USBDevice*)devices.at(i))->drive == drive)
  333. {
  334. return 1;
  335. }
  336. }
  337. return 0;
  338. }
  339. static INT_PTR CALLBACK config_dialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam,LPARAM lParam) {
  340. switch(uMsg) {
  341. case WM_INITDIALOG:
  342. {
  343. for(wchar_t d=L'A'; d<='Z'; d++) {
  344. wchar_t drive[3] = {d,L':',0}, drv[4] = {d,L':','\\',0};
  345. UINT uDriveType = GetDriveType(drv);
  346. if(uDriveType == DRIVE_REMOVABLE || uDriveType == DRIVE_CDROM || uDriveType == DRIVE_FIXED) {
  347. int position = (int)SendDlgItemMessageW(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_ADDSTRING,0,(LPARAM)drive);
  348. SendDlgItemMessage(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_SETITEMDATA,position,d);
  349. }
  350. }
  351. SendDlgItemMessage(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_SETCURSEL,0,0);
  352. SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_COMBO_MANUALCONNECT,CBN_SELCHANGE),0);
  353. }
  354. break;
  355. case WM_CLOSE:
  356. EndDialog(hwndDlg,0);
  357. break;
  358. case WM_COMMAND:
  359. switch(LOWORD(wParam)) {
  360. case IDC_COMBO_MANUALCONNECT:
  361. {
  362. if(HIWORD(wParam)==CBN_SELCHANGE) {
  363. int indx = (int)SendDlgItemMessageW(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_GETCURSEL,0,0);
  364. wchar_t drive = (wchar_t)SendDlgItemMessage(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_GETITEMDATA,indx,0);
  365. if(indx >= 0)
  366. {
  367. int connected = IsDriveConnectedToPMP(drive), isblacklisted = blacklistCheck(drive);
  368. EnableWindow(GetDlgItem(hwndDlg, IDC_MANUALCONNECT), !connected && !isblacklisted);
  369. EnableWindow(GetDlgItem(hwndDlg, IDC_MANUALDISCONNECT), connected);
  370. EnableWindow(GetDlgItem(hwndDlg, IDC_MANUALBLACKLIST), TRUE);
  371. SetDlgItemText(hwndDlg, IDC_MANUALBLACKLIST, WASABI_API_LNGSTRINGW(isblacklisted ? IDS_UNBLACKLIST_DRIVE : IDS_BLACKLIST_DRIVE));
  372. }
  373. }
  374. }
  375. break;
  376. case IDC_MANUALCONNECT:
  377. {
  378. char titleStr[32] = {0};
  379. if(MessageBoxA(hwndDlg, WASABI_API_LNGSTRING(IDS_MANUAL_CONNECT_PROMPT),
  380. WASABI_API_LNGSTRING_BUF(IDS_WARNING,titleStr,32), MB_YESNO) == IDYES)
  381. {
  382. int indx = (int)SendDlgItemMessageW(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_GETCURSEL,0,0);
  383. wchar_t drive = (wchar_t)SendDlgItemMessage(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_GETITEMDATA,indx,0);
  384. if(drive >= L'A' && drive <= L'Z') {
  385. wchar_t *bl = makeBlacklistString(drive);
  386. if (bl)
  387. {
  388. for(size_t i=0; i<blacklist.size(); i++)
  389. {
  390. if(!wcscmp(bl,(wchar_t*)blacklist.at(i)))
  391. {
  392. free(blacklist.at(i));
  393. blacklist.erase(blacklist.begin() + i);
  394. break;
  395. }
  396. }
  397. free(bl);
  398. }
  399. connectDrive(drive,false);
  400. // should do a better check here incase of failure, etc
  401. EnableWindow(GetDlgItem(hwndDlg, IDC_MANUALCONNECT), FALSE);
  402. EnableWindow(GetDlgItem(hwndDlg, IDC_MANUALDISCONNECT), TRUE);
  403. }
  404. }
  405. }
  406. break;
  407. case IDC_MANUALDISCONNECT:
  408. {
  409. int indx = (int)SendDlgItemMessageW(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_GETCURSEL,0,0);
  410. wchar_t drive = (wchar_t)SendDlgItemMessage(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_GETITEMDATA,indx,0);
  411. if(drive >= L'A' && drive <= L'Z') {
  412. for(size_t i=0; i < devices.size(); i++) {
  413. USBDevice * d = (USBDevice*)devices.at(i);
  414. if(d->drive == drive)
  415. {
  416. devices.erase(devices.begin() + i);
  417. if(config) SendMessage(config,WM_USER,0,0); //refresh fields
  418. if(config) SendMessage(config,WM_COMMAND, MAKEWPARAM(IDC_DRIVESELECT,CBN_SELCHANGE),0); //update to correct device change as if the user had clicked on the combo box themself
  419. SendMessage(plugin.hwndPortablesParent,WM_PMP_IPC,(intptr_t)d,PMP_IPC_DEVICEDISCONNECTED);
  420. SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_COMBO_MANUALCONNECT,CBN_SELCHANGE),0);
  421. delete d;
  422. }
  423. }
  424. }
  425. }
  426. break;
  427. case IDC_MANUALBLACKLIST:
  428. {
  429. int indx = (int)SendDlgItemMessageW(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_GETCURSEL,0,0);
  430. wchar_t drive = (wchar_t)SendDlgItemMessage(hwndDlg,IDC_COMBO_MANUALCONNECT,CB_GETITEMDATA,indx,0);
  431. if(drive >= L'A' && drive <= L'Z') {
  432. wchar_t *bl = makeBlacklistString(drive);
  433. if (bl)
  434. {
  435. if(!blacklistCheck(drive)) {
  436. blacklist.push_back(bl);
  437. // see if we've got a connected drive and prompt to remove it or wait till restart
  438. if(IsDriveConnectedToPMP(drive)) {
  439. wchar_t title[96] = {0};
  440. GetWindowText(hwndDlg, title, 96);
  441. if(MessageBox(hwndDlg,WASABI_API_LNGSTRINGW(IDS_DRIVE_CONNECTED_DISCONNECT_Q),title,MB_YESNO)==IDYES){
  442. SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_MANUALDISCONNECT,0),0);
  443. }
  444. }
  445. }
  446. else {
  447. for(size_t i=0; i < blacklist.size(); i++)
  448. {
  449. if(!wcscmp(bl,(wchar_t*)blacklist.at(i)))
  450. {
  451. free(blacklist.at(i));
  452. blacklist.erase(blacklist.begin() + i);
  453. break;
  454. }
  455. }
  456. free(bl);
  457. }
  458. }
  459. SendMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_COMBO_MANUALCONNECT,CBN_SELCHANGE),0);
  460. }
  461. }
  462. break;
  463. case IDOK:
  464. case IDCANCEL:
  465. blacklistSave();
  466. EndDialog(hwndDlg,0);
  467. break;
  468. }
  469. break;
  470. }
  471. return 0;
  472. }
  473. static intptr_t MessageProc(int msg, intptr_t param1, intptr_t param2, intptr_t param3)
  474. {
  475. switch(msg) {
  476. case PMP_DEVICECHANGE:
  477. return wmDeviceChange(param1,param2);
  478. case PMP_CONFIG:
  479. WASABI_API_DIALOGBOXW(IDD_CONFIG_GLOBAL,(HWND)param1,config_dialogProc);
  480. return 1;
  481. }
  482. return 0;
  483. }
  484. extern "C" __declspec(dllexport) PMPDevicePlugin *winampGetPMPDevicePlugin()
  485. {
  486. return &plugin;
  487. }