Quote
bool CemuleApp::IsEd2kLinkInClipboard(LPCSTR pszLinkType, int iLinkTypeLen)
{
bool bFoundLink = false;
if (IsClipboardFormatAvailable(CF_TEXT))
{
if (OpenClipboard(NULL))
{
HGLOBAL hText = GetClipboardData(CF_TEXT);
if (hText != NULL)
{
// Use the ANSI string
LPCSTR pszText = (LPCSTR)GlobalLock(hText);
if (pszText != NULL)
{
while (*pszText == ' ' || *pszText == '\t' || *pszText == '\r' || *pszText == '\n')
pszText++;
bFoundLink = (strncmp(pszText, pszLinkType, iLinkTypeLen) == 0);
//GlobalUnlock(hText);
}
GlobalUnlock(hText); //WiZaRd
}
...
{
bool bFoundLink = false;
if (IsClipboardFormatAvailable(CF_TEXT))
{
if (OpenClipboard(NULL))
{
HGLOBAL hText = GetClipboardData(CF_TEXT);
if (hText != NULL)
{
// Use the ANSI string
LPCSTR pszText = (LPCSTR)GlobalLock(hText);
if (pszText != NULL)
{
while (*pszText == ' ' || *pszText == '\t' || *pszText == '\r' || *pszText == '\n')
pszText++;
bFoundLink = (strncmp(pszText, pszLinkType, iLinkTypeLen) == 0);
//GlobalUnlock(hText);
}
GlobalUnlock(hText); //WiZaRd
}
...
It should never happen, though, it's better to unlock correctly