diff options
Diffstat (limited to 'Src/winampa')
-rw-r--r-- | Src/winampa/DOFTA.C | 0 | ||||
-rw-r--r-- | Src/winampa/Main.cpp | 628 | ||||
-rw-r--r-- | Src/winampa/Main.h | 66 | ||||
-rw-r--r-- | Src/winampa/RESOURCE.H | 29 | ||||
-rw-r--r-- | Src/winampa/SYSTRAY.C | 76 | ||||
-rw-r--r-- | Src/winampa/WINAMPA.RC | 98 | ||||
-rw-r--r-- | Src/winampa/WINAMPA.sln | 30 | ||||
-rw-r--r-- | Src/winampa/version.rc2 | 39 | ||||
-rw-r--r-- | Src/winampa/winampa.vcxproj | 285 | ||||
-rw-r--r-- | Src/winampa/winampa.vcxproj.filters | 55 | ||||
-rw-r--r-- | Src/winampa/winampicon.cpp | 22 |
11 files changed, 1328 insertions, 0 deletions
diff --git a/Src/winampa/DOFTA.C b/Src/winampa/DOFTA.C new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/Src/winampa/DOFTA.C diff --git a/Src/winampa/Main.cpp b/Src/winampa/Main.cpp new file mode 100644 index 00000000..137e16d1 --- /dev/null +++ b/Src/winampa/Main.cpp @@ -0,0 +1,628 @@ +#include "main.h" +#include "../nu/AutoWide.h" +#define LANG_STATIC_BUFFER_SIZE 1024 + +extern "C" void ResolveEnvironmentVariables2(wchar_t *string, wchar_t *destString, size_t stringSize); +static UINT WM_TASKBARCREATED; + +// winamp2/5 +wchar_t ini_file[MAX_PATH] = {0}, + wa2ConfigDir[MAX_PATH] = {0}, + winampClassName[MAX_PATH] = {0}, + winampaLngPath[MAX_PATH] = {0}, + icon_tmp[MAX_PATH] = {0}, + winamp_exe_file[MAX_PATH] = {0}, + bm_file[MAX_PATH] = {0}; + +static HWND hwndWinamp; +static HINSTANCE g_hInstance, winampaLng, nativeLng; +static HICON m_icon; + +typedef HRESULT(WINAPI *CHANGEWINDOWMESSAGEFILTER)(UINT message, DWORD dwFlag); +static CHANGEWINDOWMESSAGEFILTER changeWMFilter; + +int config_iconidx = -1, config_systray_icon = 1; + +static wchar_t ini_sec[] = L"WinampAgent"; + +int ReadStr(HANDLE hFile, char *str, int len) +{ + while (1) + { + DWORD l = 0; + ReadFile(hFile, str, 1, &l, 0); + if (l != 1 || *str == '\r' || *str == '\n') + { + DWORD t = 0; + ReadFile(hFile, str, 1, &t, 0); + *str = 0; + return (l == 1); + } + str++; + if (--len < 1) + { + *str = 0; + return 1; + } + } +} + +static BOOL LoadWMFilter(void){ + if (!changeWMFilter){ + changeWMFilter = (CHANGEWINDOWMESSAGEFILTER)GetProcAddress(GetModuleHandle(L"USER32"), "ChangeWindowMessageFilter"); + } + return (!!changeWMFilter); +} + +void LoadWinampaLng(void){ + winampaLng = LoadLibraryExW(winampaLngPath, NULL, LOAD_LIBRARY_AS_DATAFILE); +} + +void UnloadWinampaLng(void){ + if(winampaLng){ + FreeLibrary(winampaLng); + winampaLng = 0; + } +} + +wchar_t* GetStringW(UINT uID) +{ + static wchar_t *buf; + if (!buf) + buf = (wchar_t *)GlobalAlloc(LPTR,(LANG_STATIC_BUFFER_SIZE*sizeof(buf[0]))); + + if (!LoadStringW(winampaLng, uID, buf, LANG_STATIC_BUFFER_SIZE)) + { + if (winampaLng == nativeLng || !LoadStringW(nativeLng, uID, buf, LANG_STATIC_BUFFER_SIZE)) + { + lstrcpynW(buf, L"Error loading string", LANG_STATIC_BUFFER_SIZE); + } + } + return buf; +} + +// about the most reliable way i can find to get the Winamp window as it could +// have been started with the /CLASS= parameter which then means it won't be +// 'Winamp v1.x' so instead go for a fixed child window which will always be +// there (and deals with other apps who create a 'fake' Winamp window (like AIMP) +// and there are two versions to cope with classic or modern skins being used. +BOOL CALLBACK EnumWindowsProc(HWND hwnd, LPARAM lParam) +{ + wchar_t name[24] = {0}; + GetClassNameW(hwnd, name, 24); + // this check will only work for classic skins + if (!lstrcmpiW(name, L"Winamp PE")) + { + HWND child = GetWindow(GetWindow(hwnd, GW_CHILD), GW_CHILD); + GetClassNameW(child, name, 24); + // this check improves reliability of this check against players + // like KMPlayer which also create a fake playlist editor window + if (!lstrcmpiW(name, L"WinampVis") || lstrcmpiW(name, L"TSkinPanel")) + { + hwndWinamp = GetWindow(hwnd, GW_OWNER); + return FALSE; + } + } + // this check will only work for modern skins + else if (!lstrcmpiW(name, L"BaseWindow_RootWnd")) + { + HWND child = GetWindow(GetWindow(hwnd,GW_CHILD),GW_CHILD); + GetClassNameW(child, name, 24); + if (!lstrcmpiW(name, L"Winamp PE") || + !lstrcmpiW(name, L"Winamp Gen")) + { + hwndWinamp = GetWindow(hwnd,GW_OWNER); + return FALSE; + } + } + // and then we just try what we can (default and + // taking into account where possible /CLASS use + else if (!lstrcmpiW(name, L"Winamp v1.x") || + !lstrcmpiW(name, winampClassName)) + { + HWND child = GetWindow(hwnd,GW_CHILD); + GetClassNameW(child, name, 24); + if (!lstrcmpiW(name, L"WinampVis")) + { + hwndWinamp = hwnd; + return FALSE; + } + } + return TRUE; +} + +HWND GetWinampHWND(void) +{ + // incase things changed since last time, always re-check + hwndWinamp = 0; + EnumWindows(EnumWindowsProc, 0); + return hwndWinamp; +} + +LRESULT CALLBACK WndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + int force_icon = 0; + if (WM_TASKBARCREATED && uMsg == WM_TASKBARCREATED) + { + uMsg = WM_USER + 1; + force_icon = 1; + } + + switch (uMsg) + { + case WM_CREATE: + SendMessage(hwnd, WM_USER + 1, 0, 0); + return TRUE; + + case WM_USER + 1: + { + int iconidx; + int isintray; + + config_systray_icon = ini_file[0] ? GetPrivateProfileIntW(ini_sec, L"is_intray", 1, ini_file) : 0; + iconidx = ini_file[0] ? GetPrivateProfileIntW(L"Winamp", L"sticon", 0, ini_file) : 0; + + isintray = !!systray_isintray(); + + if ((isintray && (force_icon || iconidx != config_iconidx)) || + isintray != (config_systray_icon)) + { + HICON m_oldicon = m_icon; + m_icon = 0; + if (config_systray_icon) + { + if (iconidx != 0) + { + HMODULE h = LoadLibraryExW(winamp_exe_file, NULL, LOAD_LIBRARY_AS_DATAFILE); + if (h) + { + int geticonid(int x); // in winampicon.cpp + + int icon_to_use = geticonid(iconidx); + if(icon_to_use != -666) + { + m_icon = (HICON)LoadImage(h,MAKEINTRESOURCE(icon_to_use),IMAGE_ICON,16,16,0); + } + else + { + if(PathFileExistsW(icon_tmp)) + { + m_icon = (HICON)LoadImageW(0,icon_tmp,IMAGE_ICON,16,16,LR_LOADFROMFILE); + } + } + FreeLibrary(h); + } + } + if (!m_icon) m_icon = (HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, 16, 16, 0); + if (isintray) systray_mod(hwnd, m_icon, 0); + systray_add(hwnd, m_icon, GetStringW(IDS_WINAMP_AGENT)); + } + else systray_del(hwnd); + + if (m_oldicon) DestroyIcon(m_oldicon); + } + config_iconidx = iconidx; + } + return 0; + + case WM_CLOSE: + DestroyWindow(hwnd); + return 0; + + case WM_ENDSESSION: // JF JAN01001 added + if (wParam) + { + ExitProcess(0); + return 0; + } + break; + + case WM_USER + 8: + if (LOWORD(lParam) == WM_MOUSEMOVE) + { + static DWORD last_t; + if (GetTickCount() - last_t > 250) + { + last_t = GetTickCount(); + HWND hwnd2 = GetWinampHWND(); + if (IsWindow(hwnd2)) + { + wchar_t buf[128] = {0}; + GetWindowTextW(hwnd2, buf, 128); + systray_mod(hwnd, 0, buf); + } + else + { + systray_mod(hwnd, 0, GetStringW(IDS_WINAMP_AGENT)); + } + } + } + else if (LOWORD(lParam) == WM_LBUTTONUP || + LOWORD(lParam) == WM_LBUTTONDBLCLK) + { + if(!(GetAsyncKeyState(VK_SHIFT)&0x8000)) + { + HWND hwnd2 = GetWinampHWND(); + if (IsWindow(hwnd2)) + { + if (LOWORD(lParam) == WM_LBUTTONDBLCLK) + { + ShowWindow(hwnd2, SW_RESTORE); + } + SetForegroundWindow(hwnd2); + SendMessage(hwnd2, WM_USER + 1, 0, WM_LBUTTONUP); + } + else + { + ShellExecuteW(NULL, L"open", winamp_exe_file, L"", L".", SW_SHOW); + } + } + else + { + SendMessage(hwnd, WM_CLOSE, 0, 0); + } + } + else if (LOWORD(lParam) == WM_RBUTTONUP) + { + HWND hwnd2 = GetWinampHWND(); + if (IsWindow(hwnd2) && !(GetAsyncKeyState(VK_CONTROL)&0x8000)) + { + SetForegroundWindow(hwnd2); + SendMessage(hwnd2, WM_USER + 1, 0, WM_RBUTTONUP); + } + else + { + HMENU hMenu = CreatePopupMenu(); + MENUITEMINFOW i = {0}; + // for bookmarks menu + int num_bookmarks = 0; + // for audio cd entries + wchar_t g_audiocdletter[4] = {0}; + int g_audiocdletters = 0; + int drivemask = 0; + DWORD drives = GetLogicalDrives(); + + char fn[1024] = {0}; + char ft[1024] = {0}; + POINT p = {0}; + GetCursorPos(&p); + i.cbSize = sizeof(i); + i.fMask = MIIM_TYPE | MIIM_DATA | MIIM_ID; + i.fType = MFT_STRING; + i.wID = 1; + i.dwTypeData = GetStringW(IDS_OPEN_WINAMP); + i.cch = lstrlenW((wchar_t*)i.dwTypeData); + InsertMenuItemW(hMenu, 0, TRUE, &i); + i.wID = 0; + i.fType = MFT_SEPARATOR; + InsertMenuItemW(hMenu, 1, TRUE, &i); + + i.fMask = MIIM_TYPE | MIIM_DATA | MIIM_ID; + i.fType = MFT_STRING; + i.wID = 2; + i.dwTypeData = GetStringW(IDS_DISABLE_WINAMP_AGENT); + i.cch = lstrlenW((wchar_t*)i.dwTypeData); + InsertMenuItemW(hMenu, 2, TRUE, &i); + i.wID = 3; + i.dwTypeData = GetStringW(IDS_CLOSE_WINAMP_AGENT); + i.cch = lstrlenW((wchar_t*)i.dwTypeData); + InsertMenuItemW(hMenu, 3, TRUE, &i); + + SetMenuDefaultItem(hMenu,!(GetAsyncKeyState(VK_SHIFT)&0x8000)?0:3,1); + + i.wID = 0; + i.fType = MFT_SEPARATOR; + InsertMenuItemW(hMenu, 4, TRUE, &i); + + i.wID = 10; + for (drivemask = 0; drivemask < 32; drivemask++) + { + if (drives&(1 << drivemask)) + { + wchar_t str[256] = {0}; + StringCchPrintfW(str, 256, L"%c:\\", 'A' + drivemask); + if (GetDriveTypeW(str) == DRIVE_CDROM) + { + int old_error_mode = SetErrorMode(SEM_FAILCRITICALERRORS); + DWORD system_flags = 0, max_file_len = 0; + wchar_t drives[4] = {L" :\\"}, c = L'A' + drivemask, vol_buf[40] = {0}, empty[64] = {0}; + drives[0] = g_audiocdletter[g_audiocdletters] = c; + + GetVolumeInformationW(drives,vol_buf,sizeof(vol_buf),0,&max_file_len,&system_flags,0,0); + SetErrorMode(old_error_mode); + + lstrcpynW(empty,GetStringW(IDS_EMPTY),64); + StringCchPrintfW(str, 256, GetStringW(IDS_AUDIO_CD),c,(vol_buf[0]?vol_buf:empty)); + i.fType = MFT_STRING; + i.dwTypeData = str; + i.cch = (UINT)wcslen(str); + InsertMenuItemW(hMenu, 5 + g_audiocdletters, TRUE, &i); + i.wID++; + g_audiocdletters++; + if (g_audiocdletters == 4) break; + } + } + } + + if(g_audiocdletters) + { + i.wID = 0; + i.fType = MFT_SEPARATOR; + InsertMenuItemW(hMenu, 5 + g_audiocdletters, TRUE, &i); + } + + i.fType = MFT_STRING; + i.dwTypeData = GetStringW(IDS_BOOKMARKS); + i.cch = lstrlenW((wchar_t*)i.dwTypeData); + HMENU sm = i.hSubMenu = CreatePopupMenu(); + i.fMask |= MIIM_SUBMENU; + i.wID = 0; + InsertMenuItemW(hMenu, 6 + g_audiocdletters, TRUE, &i); + + // have to keep this ansi since winamp.bm doesn't support unicode + HANDLE hFile = CreateFileW(bm_file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + if (hFile != INVALID_HANDLE_VALUE) + { + MENUITEMINFOW ib = {0}; + ib.cbSize = sizeof(ib); + ib.fMask = MIIM_TYPE | MIIM_DATA | MIIM_ID; + ib.fType = MFT_STRING; + i.wID = ib.wID = 20; + while (1) + { + if (!ReadStr(hFile, fn, MAX_PATH)) break; + if (!ReadStr(hFile, ft, 2048)) break; + ib.dwTypeData = AutoWideDup(ft, CP_UTF8); + ib.cch = lstrlenW(ib.dwTypeData); + InsertMenuItemW(sm, num_bookmarks, TRUE, &ib); + ib.wID++; + i.wID++; + num_bookmarks++; + } + } + + if(i.wID == 20 || !i.wID) + { + i.fMask = MIIM_TYPE | MIIM_DATA | MIIM_ID; + i.fType = MFT_STRING; + i.dwTypeData = GetStringW(IDS_NO_BOOKMARKS_FOUND); + i.cch = lstrlenW((wchar_t*)i.dwTypeData); + InsertMenuItemW(sm, num_bookmarks, TRUE, &i); + EnableMenuItem(sm, i.wID, MF_BYCOMMAND | MF_GRAYED); + } + + SetForegroundWindow(hwnd); + int x = TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_RETURNCMD | TPM_RIGHTBUTTON | TPM_LEFTBUTTON | TPM_NONOTIFY, p.x, p.y, 0, hwnd, NULL); + if (x == 1) + { + HWND hwnd2 = GetWinampHWND(); + if (IsWindow(hwnd2)) + { + SetForegroundWindow(hwnd2); + SendMessage(hwnd2, WM_USER + 1, 0, WM_LBUTTONUP); + } + else + { + ShellExecuteW(NULL, L"open", winamp_exe_file, L"", L".", SW_SHOW); + } + } + else if (x == 2 || x == 3) + { + if (x == 2) // disable + { + HKEY key; + if (RegOpenKeyW(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", &key) == ERROR_SUCCESS) + { + RegDeleteValueW(key, L"WinampAgent"); + RegCloseKey(key); + } + } + SendMessage(hwnd, WM_CLOSE, 0, 0); + } + else if(x >= 10 && x < 10 + g_audiocdletters) + { + wchar_t ftW[1024] = {0}; + StringCchPrintfW(ftW, 1024, L"\"cda://%c\"", g_audiocdletter[x - 10]); + ShellExecuteW(NULL, L"open", winamp_exe_file, ftW, L".", SW_SHOW); + } + else if (x >= 20 && x < 20 + num_bookmarks && hFile != INVALID_HANDLE_VALUE) + { + int r = 0; + x -= 20; + SetFilePointer(hFile, 0, NULL, FILE_BEGIN); + for (; r <= x; r ++) + { + if (!ReadStr(hFile, fn, MAX_PATH)) break; + if (!ReadStr(hFile, ft, 2048)) break; + } + if (r == (x + 1)) + { + wchar_t ftW[1024] = {0}; + StringCchPrintfW(ftW, 1024, L"\"%s\"", AutoWide(fn, CP_UTF8)); + ShellExecuteW(NULL, L"open", winamp_exe_file, ftW, L".", SW_SHOW); + } + } + DestroyMenu(hMenu); + if (hFile != INVALID_HANDLE_VALUE) CloseHandle(hFile); + } + } + return 0; + + case WM_USER + 16: + // do this on load/unload requests just incase something went wrong + UnloadWinampaLng(); + if(!wParam) LoadWinampaLng(); + return 0; + + case WM_DESTROY: + if (systray_isintray()) systray_del(hwnd); + PostQuitMessage(0); + return 0; + } + return DefWindowProc(hwnd, uMsg, wParam, lParam); +} + +static wchar_t szClassName[] = L"WinampAgentMain"; +static wchar_t szErrorTitle[] = L"Winamp Agent Error"; + +void queryPath(wchar_t *out, wchar_t *in, int out_len) +{ + wchar_t buf[MAX_PATH] = {0}; + HKEY key = 0; + if (RegOpenKeyW(HKEY_CLASSES_ROOT, in, &key) == ERROR_SUCCESS) + { + DWORD s = sizeof(buf); + if (RegQueryValueExW(key, NULL, 0, NULL, (LPBYTE)buf, &s) == ERROR_SUCCESS) + { + if (buf[0] == L'\"') + { + wchar_t *p = buf + 1; + while (p && *p != L'\"' && *p) p=CharNextW(p); + if (p && *p) *p = 0; + while (p > buf && *p != L'\\') p = CharPrevW(buf,p); + if (p && *p) *p = 0; + lstrcpynW(out, buf + 1, out_len); + } + else + { + wchar_t *p = buf; + while (p && *p) p=CharNextW(p); + while (p > buf && *p != L'\\') p = CharPrevW(buf,p); + if (p && *p) *p = 0; + lstrcpynW(out, buf, out_len); + } + } + RegCloseKey(key); + } +} + +void BuildDirectories() +{ + // get ini_file from reg + wchar_t winamp2Folder[MAX_PATH] = {0}; + + // attempt to get the winamp folder from the play then the enqueue and then just revert to current folder (wa2/5) + queryPath(winamp2Folder, L"Winamp.File\\shell\\play\\command", MAX_PATH); + if(!winamp2Folder[0]) queryPath(winamp2Folder, L"Winamp.File\\shell\\enqueue\\command", MAX_PATH); + if(!winamp2Folder[0]) + { + wchar_t buf[MAX_PATH] = {0}, *p = buf; + GetModuleFileNameW(GetModuleHandleW(NULL), buf, sizeof(buf)); + while (p && *p) p=CharNextW(p); + while (p > buf && *p != L'\\') p=CharPrevW(buf,p); + if (p && *p) *p = 0; + lstrcpynW(winamp2Folder, buf, sizeof(winamp2Folder)); + } + + if (winamp2Folder[0]) // wa2/5 + { + wchar_t pathsIni[MAX_PATH] = {0}; + wchar_t iniFileName[MAX_PATH] = {0}; + wchar_t profileString[MAX_PATH] = {0}; + StringCchPrintfW(pathsIni, MAX_PATH, L"%s\\paths.ini", winamp2Folder); + + GetPrivateProfileStringW(L"Winamp", L"inidir", L"", profileString, MAX_PATH, pathsIni); + if (profileString[0]) + ResolveEnvironmentVariables2(profileString, wa2ConfigDir, MAX_PATH); + else + lstrcpynW(wa2ConfigDir, winamp2Folder, MAX_PATH); + + GetPrivateProfileStringW(L"Winamp", L"class", L"", profileString, MAX_PATH, pathsIni); + if (profileString[0]) + ResolveEnvironmentVariables2(profileString, winampClassName, MAX_PATH); + + GetPrivateProfileStringW(L"Winamp", L"inifile", L"", profileString, MAX_PATH, pathsIni); + if (profileString[0]) + ResolveEnvironmentVariables2(profileString, iniFileName, MAX_PATH); + else + lstrcpynW(iniFileName, L"winamp.ini", MAX_PATH); + + StringCchPrintfW(ini_file, MAX_PATH, L"%s\\%s", wa2ConfigDir, iniFileName); + + // winamp.exe should extract this out for us when a new wlz is loaded so we + // don't have to bloat up winampa - just have to deal with wlz changes instead + StringCchPrintfW(winampaLngPath, MAX_PATH, L"%s\\winampa.lng", wa2ConfigDir); + StringCchPrintfW(icon_tmp, MAX_PATH, L"%s\\winamp.ico", wa2ConfigDir); + + StringCchPrintfW(winamp_exe_file, MAX_PATH, L"%s\\winamp.exe", winamp2Folder); + StringCchPrintfW(bm_file, MAX_PATH, L"%s\\winamp.bm8", wa2ConfigDir); + // just make sure if a winamp.bm8 doesn't exist then + // go make one from winamp.bm - implemented for 5.58+ + if(!PathFileExistsW(bm_file)) + { + wchar_t tmp[MAX_PATH] = {0}; + StringCchPrintfW(tmp, MAX_PATH, L"%s\\winamp.bm", wa2ConfigDir); + CopyFileW(tmp,bm_file,FALSE); + } + } + + if (!winampClassName[0]) + lstrcpynW(winampClassName, L"Winamp v1.x", MAX_PATH); +} + +int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +{ + MSG msg = {0}; + static WNDCLASSW wc; + + if (FindWindowW(szClassName, NULL)) + { + ExitProcess(0); + } + + WM_TASKBARCREATED = RegisterWindowMessageW(L"TaskbarCreated"); + + // add in a UIPI filter so we can get required notifications from winamp.exe such + // as when we're started from an elevation request e.g. via prefs dialog options. + if (LoadWMFilter()){ + changeWMFilter(WM_USER+1, 1/*MSGFLT_ADD*/); + changeWMFilter(WM_USER+16, 1/*MSGFLT_ADD*/); + } + + wc.lpfnWndProc = WndProc; + g_hInstance = wc.hInstance = GetModuleHandleW(NULL); + wc.lpszClassName = szClassName; + + BuildDirectories(); + + // attempt to load winampa.lng if present (if extracted from the current wlz if there is one) + nativeLng = hInstance; + LoadWinampaLng(); + + if (!RegisterClassW(&wc)) + { + MessageBoxW(NULL, L"Cannot register window class!", szErrorTitle, MB_OK | MB_ICONSTOP); + return 0; + } + + if (!(CreateWindowExW(WS_EX_TOPMOST | WS_EX_TOOLWINDOW, szClassName, L"", 0, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + NULL, NULL, g_hInstance, NULL))) + { + MessageBoxW(NULL, L"Cannot create window!", szErrorTitle, MB_OK | MB_ICONSTOP); + return 0; + } + + while (GetMessageW(&msg, NULL, 0, 0)) + { + DispatchMessageW(&msg); + } // while(GetMessage... + + UnloadWinampaLng(); + ExitProcess(0); + return 0; +} + +#ifdef DO_LOG +void do_log_print(char *p) +{ + HANDLE h = CreateFile("C:\\winampa.log", GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, 0, NULL); + if (h != INVALID_HANDLE_VALUE) + { + DWORD l = 0; + SetFilePointer(h, 0, NULL, FILE_END); + WriteFile(h, p, lstrlen(p), &l, NULL); + CloseHandle(h); + } +} +#endif
\ No newline at end of file diff --git a/Src/winampa/Main.h b/Src/winampa/Main.h new file mode 100644 index 00000000..43b7cd55 --- /dev/null +++ b/Src/winampa/Main.h @@ -0,0 +1,66 @@ +#include <windows.h> +#include <shlwapi.h> +#include <strsafe.h> +#include "resource.h" + +#ifdef __cplusplus +extern "C" { +#endif + +//#define DO_LOG + +extern char g_uniqueidstring[33]; +extern int g_uniqueidint[4]; +extern int g_oid; + +// inet.c +int isInetAvailable(void); +void fixstring(char *out, char *in, int maxout); +void fixstring_slashconv(char *out, char *in, int maxout); + +// systray.c +BOOL systray_add(HWND hwnd, HICON hIcon, LPWSTR lpszTip); +BOOL systray_mod(HWND hwnd, HICON hIcon, LPWSTR lpszTip); +BOOL systray_del(HWND hwnd); +BOOL systray_isintray(void); + +extern int config_systray_icon,config_check_nvc; + + +// donvc.c +void do_check_nvc(void); + +// wms.c +void kill_server(void); +char *run_server(int port, int maxcon, int maxcps); +void set_maxcps(int maxcps); +void set_maxcon(int maxcon); +extern char g_password[64]; + +// wmsdb.c +void wmsdbFlush(void); +int wmsdbAddFiles(char *pathlist); +void wmsdbGetFile(int p, char *data, int *len, char *meta); +int wmsdbGetNumFiles(void); + +// wmsyp.c +void wmsyp_start(void); +void wmsyp_quit(void); + +extern wchar_t ini_file[MAX_PATH],wms_file[MAX_PATH],indx_file[MAX_PATH],winamp_exe_file[MAX_PATH]; + +// mp3info.c +void mp3_getmetainfo(HANDLE hf,char *meta); + +// wavinfo.c +void wav_getmetainfo(char *filename,char *meta); + +#ifdef DO_LOG +void do_log_print(char *); +#else +#define do_log_print(x) +#endif + +#ifdef __cplusplus +} +#endif
\ No newline at end of file diff --git a/Src/winampa/RESOURCE.H b/Src/winampa/RESOURCE.H new file mode 100644 index 00000000..d2254c52 --- /dev/null +++ b/Src/winampa/RESOURCE.H @@ -0,0 +1,29 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by winampa.rc +// +#define IDS_WINAMP_AGENT 0 +#define IDS_OPEN_WINAMP 1 +#define IDS_DISABLE_WINAMP_AGENT 2 +#define IDS_CLOSE_WINAMP_AGENT 3 +#define IDS_AUDIO_CD 4 +#define IDS_EMPTY 5 +#define IDS_BOOKMARKS 6 +#define IDS_NO_BOOKMARKS_FOUND 7 +#define IDS_WINAMP_AGENT_ERROR 8 +#define IDS_CANNOT_REGISTER_WINDOW_CLASS 9 +#define IDS_STRING10 10 +#define IDS_CANNOT_CREATE_WINDOW 10 +#define IDI_ICON1 101 +#define IDS_STRING105 65535 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 102 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/Src/winampa/SYSTRAY.C b/Src/winampa/SYSTRAY.C new file mode 100644 index 00000000..b8d0d464 --- /dev/null +++ b/Src/winampa/SYSTRAY.C @@ -0,0 +1,76 @@ +#include "main.h" + +#define SYSTRAY_ICON_BASE 1024 + +int ist = 0; + +BOOL systray_isintray(void) +{ + return ist; +} + +void CopyCharW(wchar_t *dest, const wchar_t *src) +{ + wchar_t *end = CharNextW(src); + int count = (int)(end-src); + while (count--) + { + *dest++=*src++; + } +} + +static void mktipstr(wchar_t *out, wchar_t *in, size_t outlen) +{ + wchar_t *nextOut; + size_t outpos=0; + while (outpos < outlen-1 && *in) + { + if (*in == L'&') + { + if ((outpos+=2) >= outlen-1) break; + *out++=L'&'; + *out++=L'&'; + } + + CopyCharW(out, in); + nextOut = CharNextW(out); + in = CharNextW(in); + outpos+=(nextOut-out); + out=nextOut; + } + *out=0; +} + +BOOL systray_add(HWND hwnd, HICON hIcon, LPWSTR lpszTip) +{ + NOTIFYICONDATAW tnid = {0}; + tnid.cbSize = sizeof(NOTIFYICONDATAW); + tnid.hWnd = hwnd; + tnid.uID = SYSTRAY_ICON_BASE; + tnid.uFlags = NIF_ICON | NIF_TIP | NIF_MESSAGE; + tnid.uCallbackMessage = WM_USER+8; + tnid.hIcon = hIcon; + mktipstr(tnid.szTip, lpszTip, sizeof(tnid.szTip)/sizeof(wchar_t)); + ist = 1; + return Shell_NotifyIconW(NIM_ADD, &tnid); +} + +BOOL systray_mod(HWND hwnd, HICON hIcon, LPWSTR lpszTip) { + NOTIFYICONDATAW tnid = {0}; + tnid.cbSize = sizeof(NOTIFYICONDATAW); + tnid.hWnd = hwnd; + tnid.uID = SYSTRAY_ICON_BASE; + tnid.hIcon = hIcon; + tnid.uFlags = (lpszTip ? NIF_TIP : 0) | (hIcon ? NIF_ICON : 0); + if (lpszTip) mktipstr(tnid.szTip, lpszTip, sizeof(tnid.szTip)/sizeof(wchar_t)); + return (Shell_NotifyIconW(NIM_MODIFY, &tnid)); +} + +BOOL systray_del(HWND hwnd) { + NOTIFYICONDATAW tnid = {0}; + tnid.cbSize = sizeof(NOTIFYICONDATAW); + tnid.hWnd = hwnd; + tnid.uID = SYSTRAY_ICON_BASE; + ist = 0; + return(Shell_NotifyIconW(NIM_DELETE, &tnid)); +}
\ No newline at end of file diff --git a/Src/winampa/WINAMPA.RC b/Src/winampa/WINAMPA.RC new file mode 100644 index 00000000..004ccadd --- /dev/null +++ b/Src/winampa/WINAMPA.RC @@ -0,0 +1,98 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "afxres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "#include ""version.rc2""\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON1 ICON "..\\Winamp\\resource\\WinampIcon.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_WINAMP_AGENT "Winamp Agent" + IDS_OPEN_WINAMP "Open Winamp" + IDS_DISABLE_WINAMP_AGENT "Disable Winamp Agent" + IDS_CLOSE_WINAMP_AGENT "Close Winamp Agent" + IDS_AUDIO_CD "Audio CD %c: [%s]" + IDS_EMPTY "Empty" + IDS_BOOKMARKS "Bookmarks" + IDS_NO_BOOKMARKS_FOUND "No bookmarks found" + IDS_WINAMP_AGENT_ERROR "Winamp Agent Error" + IDS_CANNOT_REGISTER_WINDOW_CLASS "Cannot register window class!" + IDS_CANNOT_CREATE_WINDOW "Cannot create window!" +END + +STRINGTABLE +BEGIN + 65535 "{0E844B2A-70E8-4007-A73A-E9C05DB3F06D}" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// +#include "version.rc2" + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Src/winampa/WINAMPA.sln b/Src/winampa/WINAMPA.sln new file mode 100644 index 00000000..634784f2 --- /dev/null +++ b/Src/winampa/WINAMPA.sln @@ -0,0 +1,30 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29424.173 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winampa", "winampa.vcxproj", "{EF082058-B95A-4627-950A-8A825251785D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EF082058-B95A-4627-950A-8A825251785D}.Debug|Win32.ActiveCfg = Debug|Win32 + {EF082058-B95A-4627-950A-8A825251785D}.Debug|Win32.Build.0 = Debug|Win32 + {EF082058-B95A-4627-950A-8A825251785D}.Debug|x64.ActiveCfg = Debug|x64 + {EF082058-B95A-4627-950A-8A825251785D}.Debug|x64.Build.0 = Debug|x64 + {EF082058-B95A-4627-950A-8A825251785D}.Release|Win32.ActiveCfg = Release|Win32 + {EF082058-B95A-4627-950A-8A825251785D}.Release|Win32.Build.0 = Release|Win32 + {EF082058-B95A-4627-950A-8A825251785D}.Release|x64.ActiveCfg = Release|x64 + {EF082058-B95A-4627-950A-8A825251785D}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {0BE98B4B-45F1-42A7-ADA6-004FED1CD9B3} + EndGlobalSection +EndGlobal diff --git a/Src/winampa/version.rc2 b/Src/winampa/version.rc2 new file mode 100644 index 00000000..73012be1 --- /dev/null +++ b/Src/winampa/version.rc2 @@ -0,0 +1,39 @@ + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// +#include "../Winamp/buildType.h" +VS_VERSION_INFO VERSIONINFO + FILEVERSION WINAMP_PRODUCTVER + PRODUCTVERSION WINAMP_PRODUCTVER + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Winamp SA" + VALUE "FileDescription", "Winamp Agent" + VALUE "FileVersion", STR_WINAMP_PRODUCTVER + VALUE "InternalName", "Winamp Agent" + VALUE "LegalCopyright", "Copyright © 1997-2023 Winamp SA" + VALUE "LegalTrademarks", "Nullsoft and Winamp are trademarks of Winamp SA" + VALUE "OriginalFilename", "winampa.exe" + VALUE "ProductName", "Winamp" + VALUE "ProductVersion", STR_WINAMP_PRODUCTVER + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/Src/winampa/winampa.vcxproj b/Src/winampa/winampa.vcxproj new file mode 100644 index 00000000..280377ff --- /dev/null +++ b/Src/winampa/winampa.vcxproj @@ -0,0 +1,285 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup Label="ProjectConfigurations"> + <ProjectConfiguration Include="Debug|Win32"> + <Configuration>Debug</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Debug|x64"> + <Configuration>Debug</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|Win32"> + <Configuration>Release</Configuration> + <Platform>Win32</Platform> + </ProjectConfiguration> + <ProjectConfiguration Include="Release|x64"> + <Configuration>Release</Configuration> + <Platform>x64</Platform> + </ProjectConfiguration> + </ItemGroup> + <PropertyGroup Label="Globals"> + <ProjectGuid>{EF082058-B95A-4627-950A-8A825251785D}</ProjectGuid> + <RootNamespace>winampa</RootNamespace> + <WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <PlatformToolset>v142</PlatformToolset> + <CharacterSet>Unicode</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> + <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + <IncludePath>$(IncludePath)</IncludePath> + <LibraryPath>$(LibraryPath)</LibraryPath> + </PropertyGroup> + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <LinkIncremental>false</LinkIncremental> + <OutDir>$(PlatformShortName)_$(Configuration)\</OutDir> + <IntDir>$(PlatformShortName)_$(Configuration)\</IntDir> + </PropertyGroup> + <PropertyGroup Label="Vcpkg"> + <VcpkgEnableManifest>false</VcpkgEnableManifest> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgConfiguration>Debug</VcpkgConfiguration> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + <VcpkgConfiguration>Debug</VcpkgConfiguration> + </PropertyGroup> + <PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <VcpkgInstalledDir> + </VcpkgInstalledDir> + <VcpkgUseStatic>false</VcpkgUseStatic> + <VcpkgTriplet>x86-windows-static-md</VcpkgTriplet> + </PropertyGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;NO_INPLACE_RESOLVE;_WIN32_WINNT=0x0601;WINVER=0x0601;_WIN32_IE=0x0A00;_UNICODE;UNICODE;_WA_IPC_LEAN_H_;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> + <ObjectFileName>$(IntDir)</ObjectFileName> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Link> + <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D /S $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ +xcopy /Y /D /S $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command> + <Message>Post build event: 'xcopy /Y /D /S $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> + <ClCompile> + <Optimization>Disabled</Optimization> + <AdditionalIncludeDirectories>../Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;NO_INPLACE_RESOLVE;_WIN32_WINNT=0x0601;WINVER=0x0601;_WIN32_IE=0x0A00;_UNICODE;UNICODE;_WA_IPC_LEAN_H_;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <MinimalRebuild>false</MinimalRebuild> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + <AssemblerListingLocation>$(IntDir)</AssemblerListingLocation> + <ObjectFileName>$(IntDir)</ObjectFileName> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> + <WarningLevel>Level3</WarningLevel> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Link> + <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <GenerateDebugInformation>true</GenerateDebugInformation> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D /S $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ +xcopy /Y /D /S $(IntDir)$(TargetName).pdb ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command> + <Message>Post build event: 'xcopy /Y /D /S $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> + <ClCompile> + <Optimization>MinSpace</Optimization> + <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>../Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;NO_INPLACE_RESOLVE;_WIN32_WINNT=0x0601;WINVER=0x0601;_WIN32_IE=0x0A00;_UNICODE;UNICODE;_WA_IPC_LEAN_H_;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <BufferSecurityCheck>false</BufferSecurityCheck> + <ObjectFileName>$(IntDir)</ObjectFileName> + <DebugInformationFormat>None</DebugInformationFormat> + <WarningLevel>Level3</WarningLevel> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Link> + <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <TargetMachine>MachineX86</TargetMachine> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D /S $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command> + <Message>Post build event: 'xcopy /Y /D /S $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> + <ClCompile> + <Optimization>MinSpace</Optimization> + <FavorSizeOrSpeed>Size</FavorSizeOrSpeed> + <AdditionalIncludeDirectories>../Wasabi;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;NO_INPLACE_RESOLVE;_WIN32_WINNT=0x0601;WINVER=0x0601;_WIN32_IE=0x0A00;_UNICODE;UNICODE;_WA_IPC_LEAN_H_;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <StringPooling>true</StringPooling> + <MultiProcessorCompilation>true</MultiProcessorCompilation> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <BufferSecurityCheck>false</BufferSecurityCheck> + <ObjectFileName>$(IntDir)</ObjectFileName> + <DebugInformationFormat>None</DebugInformationFormat> + <WarningLevel>Level3</WarningLevel> + <ProgramDataBaseFileName>$(IntDir)$(TargetName).pdb</ProgramDataBaseFileName> + </ClCompile> + <ResourceCompile> + <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> + <Culture>0x0409</Culture> + </ResourceCompile> + <Link> + <AdditionalDependencies>shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies> + <OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile> + <GenerateDebugInformation>false</GenerateDebugInformation> + <ProgramDatabaseFile>$(IntDir)$(TargetName).pdb</ProgramDatabaseFile> + <SubSystem>Windows</SubSystem> + <OptimizeReferences>true</OptimizeReferences> + <EnableCOMDATFolding>true</EnableCOMDATFolding> + <RandomizedBaseAddress>false</RandomizedBaseAddress> + <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> + <AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <PostBuildEvent> + <Command>xcopy /Y /D /S $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\ </Command> + <Message>Post build event: 'xcopy /Y /D /S $(OutDir)$(TargetName)$(TargetExt) ..\..\Build\Winamp_$(PlatformShortName)_$(Configuration)\'</Message> + </PostBuildEvent> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="..\Winamp\paths.cpp" /> + <ClCompile Include="dofta.c" /> + <ClCompile Include="Main.cpp" /> + <ClCompile Include="systray.c" /> + <ClCompile Include="winampicon.cpp" /> + </ItemGroup> + <ItemGroup> + <ClInclude Include="main.h" /> + <ClInclude Include="resource.h" /> + </ItemGroup> + <ItemGroup> + <Image Include="..\Winamp\resource\WinampIcon.ico" /> + <Image Include="..\Winamp\resource\ICON1.ICO" /> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="winampa.rc" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\Wasabi\Wasabi.vcxproj"> + <Project>{3e0bfa8a-b86a-42e9-a33f-ec294f823f7f}</Project> + </ProjectReference> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/Src/winampa/winampa.vcxproj.filters b/Src/winampa/winampa.vcxproj.filters new file mode 100644 index 00000000..63f0c5b3 --- /dev/null +++ b/Src/winampa/winampa.vcxproj.filters @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <ClCompile Include="Main.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="..\Winamp\paths.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="systray.c"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="winampicon.cpp"> + <Filter>Source Files</Filter> + </ClCompile> + <ClCompile Include="dofta.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> + <ItemGroup> + <ClInclude Include="main.h"> + <Filter>Header Files</Filter> + </ClInclude> + <ClInclude Include="resource.h"> + <Filter>Header Files</Filter> + </ClInclude> + </ItemGroup> + <ItemGroup> + <Image Include="..\Winamp\resource\WinampIcon.ico"> + <Filter>Image Files</Filter> + </Image> + <Image Include="..\Winamp\resource\ICON1.ICO"> + <Filter>Image Files</Filter> + </Image> + </ItemGroup> + <ItemGroup> + <Filter Include="Header Files"> + <UniqueIdentifier>{deb6fdb6-1c54-495d-9836-ab30447b9138}</UniqueIdentifier> + </Filter> + <Filter Include="Ressource Files"> + <UniqueIdentifier>{9ff1fdde-82f4-4809-8d9c-cd8b55f26076}</UniqueIdentifier> + </Filter> + <Filter Include="Source Files"> + <UniqueIdentifier>{12c4bea0-54c8-4891-b72f-e10796b156d6}</UniqueIdentifier> + </Filter> + <Filter Include="Image Files"> + <UniqueIdentifier>{4fb219e9-803e-4cdb-9fef-1fe010683a73}</UniqueIdentifier> + </Filter> + </ItemGroup> + <ItemGroup> + <ResourceCompile Include="winampa.rc"> + <Filter>Ressource Files</Filter> + </ResourceCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/Src/winampa/winampicon.cpp b/Src/winampa/winampicon.cpp new file mode 100644 index 00000000..e62d82b3 --- /dev/null +++ b/Src/winampa/winampicon.cpp @@ -0,0 +1,22 @@ +#include "../winamp/resource.h" + +int geticonid(int x) +{ + switch (x) + { + case 1: return IDI_FILEICON; + case 2: return IDI_FILEICON2; + case 3: return IDI_FILEICON3; + case 4: return IDI_FILEICON10; + case 5: return IDI_FILEICON5; + case 6: return IDI_FILEICON6; + case 7: return IDI_FILEICON7; + case 8: return IDI_FILEICON8; + case 9: return IDI_FILEICON9; + case 10: return IDI_FILEICON4; + case 11: return IDI_FILEICON11; + case 12: return ICON_TB1; + case 13: return -666; + default: return ICON_XP; + } +}
\ No newline at end of file |