Exemple #1
0
void ShutdownSystray()
{
	if(m_hWndTray != NULL)
	{
		DestroyWindow(m_hWndTray);
		UnregisterClass(L"TrayNotifyWnd", m_hInstance);
		ODS("TrayNotifyWnd destroyed.\n");
	}

	if(m_hWndNotify != NULL)
	{
		DestroyWindow(m_hWndNotify);
		UnregisterClass(L"Shell_TrayWnd", m_hInstance);
		ODS("Shell_TrayWnd destroyed.\n");
	}
}
Exemple #2
0
//---------------------------------------------------------------------------
BOOL PacketDeviceIoControl (LPADAPTER lpAdapterObject,
			      LPPACKET lpPacket,
			      ULONG ulIoctl,
			      BOOLEAN bSync)
{
	BOOLEAN Result;
	DWORD Error;

	ODS ("Packet32: PacketDeviceIoControl\n");
	_ASSERTE (lpAdapterObject != NULL);
	_ASSERTE (lpPacket != NULL);
	lpPacket->OverLapped.Offset = 0;
	lpPacket->OverLapped.OffsetHigh = 0;
	lpPacket->ulBytesReceived		= 0;
	if (!ResetEvent (lpPacket->OverLapped.hEvent))
	{
		lpPacket->bIoComplete = FALSE;
		return FALSE;
	}

    Result = DeviceIoControl (lpAdapterObject->hFile,
				ulIoctl,
				lpPacket->Buffer,
				lpPacket->Length,
				lpPacket->Buffer,
				lpPacket->Length,
				&(lpPacket->ulBytesReceived), 
				&(lpPacket->OverLapped));
	Error=GetLastError () ;
    
	if (!Result && bSync)
	{
		if (Error == ERROR_IO_PENDING)
		{
			Result = GetOverlappedResult (lpAdapterObject->hFile,
					&(lpPacket->OverLapped),
					&(lpPacket->ulBytesReceived), 
					TRUE);
		}
		else
			ODS ("Packet32: unsupported API call return error!\n");
	}

	lpPacket->bIoComplete = Result;

	return Result;
}
Exemple #3
0
////////////////////////////////////////////////////////////////////////
// Remove
//
HRESULT CDocProperty::Remove()
{
	ODS(_T("CDocProperty::Remove\n"));
	CHECK_FLAG_RETURN((m_fDeadObj || m_fRemovedItem), E_INVALIDOBJECT);
	VariantClear(&m_vValue);
	m_fRemovedItem = TRUE;
	return S_OK;
}
void TTrdItf_DDABOSS::SetError(void)
{
   char buffer[512];
   strcpy(FLastError.Sender,"DDABOSS");
	 FLastError.ErrorCode = FDll.FixGetInt(FFix, FID_CODE);
	 lstrcpyn( FLastError.Text,FDll.FixGet(FFix, FID_MESSAGE, buffer, 0),MAX_TEXT );
	 ODS('M',PLUGINNAME,"ErrCode=%d,%s",FLastError.ErrorCode,FLastError.Text);
}
// *********************** CShellExt *************************
CFindExtension::CFindExtension()
{
    ODS("CShellExt::CShellExt()\r\n");

    m_cRef = 0L;

    g_cRefThisDll++;
}
Exemple #6
0
void ShutdownTask()
{
	if(m_ShellHook != NULL)
	{
		UnhookWindowsHookEx(m_ShellHook);
		ODS("ShellHook unhooked.");
	}
}
CShellExtClassFactory::CShellExtClassFactory()
{
    ODS(L"CShellExtClassFactory::CShellExtClassFactory()\r\n");

    m_cRef = 0L;

    g_cRefThisDll++;
}
STDMETHODIMP CFindExtension::Initialize(LPCITEMIDLIST pIDFolder,
                                   LPDATAOBJECT pDataObj,
                                   HKEY hRegKey)
{
	ODS("CFindExtension::Initialize()\r\n");
	
    return NOERROR;
}
Exemple #9
0
void InitializeTask()
{
	m_ShellHook = SetWindowsHookEx(WH_SHELL, (HOOKPROC)ShellProc, m_hInstance, 0);
	if(m_ShellHook != NULL)
	{
		ODS("Shell hook created\n");
	}
}
market_type  TTrdItf_DDABOSS::ConvertMarketType(const char *t)
{
	if(t==NULL || strlen(t)<2 ) return mtNo;
	if( t[1] == 'H' ) return mtSHA;
	if( t[1] == 'Z' ) return mtSZA;
	ODS('M',PLUGINNAME,"MarketType = %s",t);
	return mtNo;
}
Exemple #11
0
static void createEvents()
{
    eventEnter = CreateEvent(NULL, false, false, _T("Local\\Shachar_Shemesh_TempLang_Event_Enter"));
    if(eventEnter == NULL) {
        ODS(_T("Failed to create enter event: %ld"), GetLastError());
        return;
    }
    eventHookInstalled = CreateEvent(NULL, false, false, _T("Local\\Shachar_Shemesh_TempLang_Event_Hook"));
    if(eventHookInstalled == NULL) {
        ODS(_T("Failed to create hook installed event: %ld"), GetLastError());
        return;
    }
    eventExit = CreateEvent(NULL, false, false, _T("Local\\Shachar_Shemesh_TempLang_Event_Exit"));
    if(eventExit == NULL) {
        ODS(_T("Failed to create exit event: %ld"), GetLastError());
        return;
    }
}
////////////////////////////////////////////////////////////////////////
// Release
//
STDMETHODIMP_(ULONG) CRatDVDClassFactory::Release(void)
{
    if ( 0 != --m_cRef ) return m_cRef;

	ODS(_T("CRatDVDClassFactory delete\n"));

    LockServer(FALSE);
    return 0;
}
STDMETHODIMP CFindExtension::QueryContextMenu(HMENU hMenu,
                                         UINT indexMenu,
                                         UINT idCmdFirst,
                                         UINT idCmdLast,
                                         UINT uFlags)
{
    ODS("CFindExtension::QueryContextMenu()\r\n");
	return NOERROR;
}
// *********************** CShellExt *************************
CLocateShellExtension::CLocateShellExtension()
{
    ODS("CShellExt::CShellExt()");

    m_cRef = 0L;
    m_pDataObj = NULL;

    g_cRefThisDll++;
}
Exemple #15
0
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
    if (dwReason == DLL_PROCESS_ATTACH)
    {
        ODS(L"In DLLMain, DLL_PROCESS_ATTACH\r\n");

        // Extension DLL one-time initialization

        g_hmodThisDll = hInstance;
    }
    else if (dwReason == DLL_PROCESS_DETACH)
    {
        ODS(L"In DLLMain, DLL_PROCESS_DETACH\r\n");
    }

    return 1;   // ok
}
// Our icon overlay priority
STDMETHODIMP CShellExt::GetPriority(int *pPriority)
{
	ODS("In GetPriority\r\n");

	//highest priority
	*pPriority = 0;

	return S_OK;
}
Exemple #17
0
// *********************** CShellExt *************************
CShellExt::CShellExt()
{
    ODS(L"CShellExt::CShellExt()\r\n");

    m_cRef = 0L;
    m_pDataObj = NULL;

    g_cRefThisDll++;
}
Exemple #18
0
void RecvEventsTh::ConnectToServer(void)
{
	int nReturn;
	sockaddr_in tagSockAddrServer;
	// Set values to server sockaddr
	memset (&tagSockAddrServer, 0, sizeof (tagSockAddrServer) );
	tagSockAddrServer.sin_family = AF_INET;
	tagSockAddrServer.sin_port = htons(PushPort);
	tagSockAddrServer.sin_addr.S_un.S_addr = inet_addr (SvrIp.c_str());

	// Create the socket
	hSockContral = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
	if (hSockContral == INVALID_SOCKET)
	{
		ODS('E',"JSDEventsRecv","Create socket Error Number: %d.",GetLastError());
		return;
	}
	
	// connect to server
	nReturn = connect (hSockContral, (sockaddr*) &tagSockAddrServer, sizeof (tagSockAddrServer) );
	if (nReturn == -1)
	{
		ODS('E',"JSDEventsRecv","Connect failed, Error Number: %d, Message : client connected to server %s.",
			GetLastError(),inet_ntoa (tagSockAddrServer.sin_addr));
		closesocket (hSockContral);
		hSockContral = INVALID_SOCKET;
		return;
	}

	last_ping_tick = 0;
	// send connect command to server
	char szSend[MSG_MAXLEN];
	memset(szSend, 0, sizeof(szSend));
	ST_PUSHHEAD* pstPushHead = (ST_PUSHHEAD *)szSend;
	pstPushHead->usType = htons(CMD_CONNECT);
	nReturn = ::send(hSockContral, szSend, sizeof(szSend), 0);
	if (nReturn == -1)
	{
		ODS('E',"JSDEventsRecv","login failed, Error Number: %d.",GetLastError());
		closesocket (hSockContral);
		hSockContral = INVALID_SOCKET;
		return;
	}
}
Exemple #19
0
void InitializeSystray()
{
	memset(&m_TrayClass, 0, sizeof(m_TrayClass));
	
	m_TrayClass.lpszClassName = L"Shell_TrayWnd";
	m_TrayClass.lpfnWndProc = WndProc;
	m_TrayClass.style = CS_DBLCLKS;
	m_TrayClass.hInstance = m_hInstance;

	RegisterClass( &m_TrayClass );

	m_hWndTray = CreateWindowEx(	WS_EX_TOPMOST | WS_EX_TOOLWINDOW,
								TEXT("Shell_TrayWnd"),
								TEXT(""),
								WS_POPUP,
								0, 0,
								0, 0,
								NULL,
								NULL,
								m_hInstance,
								NULL);

	ODS("Shell_TrayWnd Created\n");

	memset(&m_NotifyClass,0, sizeof(m_NotifyClass));
     m_NotifyClass.lpszClassName = TEXT("TrayNotifyWnd");
     m_NotifyClass.lpfnWndProc = WndProc;
     //m_NotifyClass.cbSize = sizeof(WNDCLASSEX);
     m_NotifyClass.hInstance = m_hInstance;
     m_NotifyClass.style = CS_DBLCLKS;
     
     RegisterClass(&m_NotifyClass);
        
	 m_hWndNotify = CreateWindowEx( 0,
              TEXT("TrayNotifyWnd"), 
              NULL,
              WS_CHILD,
              0, 0, 0, 0,
              m_hWndTray, NULL,
              m_hInstance,
              NULL);

	 ODS("TrayNotifyWnd Created\n");
}
int CLocateShellExtension::InsertMenuItems(HMENU hMenu,UINT nStartIndex,UINT idCmdFirst,UINT& nHighestUsedID)
{
	ODS("CShellExt::InsertMenuItems()");
	
	if (m_pDataObj==NULL)
		return 0;

	
	

	

	
	MENUITEMINFOW mii;
	mii.cbSize=sizeof(MENUITEMINFOW);
	mii.fMask=MIIM_ID|MIIM_TYPE;
	mii.fType=MFT_STRING;
	mii.dwTypeData=L"Files:";
	mii.wID=idCmdFirst;
    InsertMenuItemW(hMenu,nStartIndex++,TRUE,&mii);

	for (int i=0;i<m_aFiles.GetSize();i++)
	{
		mii.wID++;
		mii.dwTypeData=m_aFiles[i];
		InsertMenuItemW(hMenu,nStartIndex++,TRUE,&mii);
	}

	mii.wID++;
	mii.dwTypeData=L"Directories:";
	InsertMenuItemW(hMenu,nStartIndex++,TRUE,&mii);
	
	for (int i=0;i<m_aDirectories.GetSize();i++)
	{
		mii.wID++;
		mii.dwTypeData=m_aDirectories[i];
		InsertMenuItemW(hMenu,nStartIndex++,TRUE,&mii);
	}


	mii.wID++;
	mii.dwTypeData=L"Computers:";
	InsertMenuItemW(hMenu,nStartIndex++,TRUE,&mii);
	
	for (int i=0;i<m_aComputers.GetSize();i++)
	{
		mii.wID++;
		mii.dwTypeData=m_aComputers[i];
		InsertMenuItemW(hMenu,nStartIndex++,TRUE,&mii);
	}

	
	nHighestUsedID=mii.wID;
	
	return mii.wID-idCmdFirst+1;
}
order_type   TTrdItf_DDABOSS::ConvertOrderType(const char *t)
{
	if(t==NULL || strlen(t)<1 ) return otNo;
	if( strcmp(t,"1") == 0 ) return otBuy;
	if( strcmp(t,"2") == 0 ) return otSell;
	if( strcmp(t,"29") == 0 ) return otETFSub;
	if( strcmp(t,"30") == 0 ) return otETFRed;
	ODS('M',PLUGINNAME,"OrderType = %s",t);
	return otNo;
}
////////////////////////////////////////////////////////////////////////
// CDsoFramerClassFactory::Release
//
STDMETHODIMP_(ULONG) CDsoFramerClassFactory::Release(void)
{
	TRACE1("CDsoFramerClassFactory::Release - %d\n", m_cRef-1);
    if (0 != --m_cRef) return m_cRef;

	ODS("CDsoFramerClassFactory delete\n");
	InterlockedDecrement((LPLONG)&v_cLocks);
    delete this;
    return 0;
}
Exemple #23
0
void DumpStats( void )
         {
            DWORD dwFree, dwUsed, dwChunks, dwFreeChunks;
            char msg[256];
            GetMemStats(&dwFree, &dwUsed, &dwChunks, &dwFreeChunks);
            sprintf( msg, WIDE("MemStat: Used: %d(%d) Free: %d(%d)")
                        , dwUsed, dwChunks - dwFreeChunks
                        , dwFree, dwFreeChunks );
            ODS( msg );
         }
Exemple #24
0
STDMETHODIMP_(ULONG) CShellExtClassFactory::AddRef()
{
    ODS("CShellExtClassFactory::AddRef()\r\n");

	char szNum[100];
	wsprintf(szNum,"m_cRef is after this call %d",m_cRef+1);
	DebugMessage(szNum);

	return ++m_cRef;
}
Exemple #25
0
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	ODS("WndProc called.\n");
	switch(msg)
	{
	case WM_COPYDATA:
		{
			COPYDATASTRUCT *copyData = (COPYDATASTRUCT *)lParam;
			if(copyData == NULL)
			{
				ODS("CopyData is null. Returning.");
				return DefWindowProc(hWnd, msg, wParam, lParam);
			}

			switch(copyData->dwData)
			{
			case 0:
				// This is supposed to just 'pass it along' to the default handler, but it doesn't
				// Currently i'm just setting up the app bar before we initialize this, but we need to research this
				// further and find a final solution.. (broc)
				return FALSE;
				break;
			case 1:
				int offset = 8;

				if (sizeof(void*) == 8)
				{
					offset = -4;
				}

				NOTIFYICONDATA *nicData = (NOTIFYICONDATA *)(((BYTE *)copyData->lpData) + offset);
				int TrayCmd = *(INT *) (((BYTE *)copyData->lpData) + 4);

				BOOL result = CallSystrayDelegate(TrayCmd, *nicData);
				if(result) OutputDebugString(L"Result is true.");
				else OutputDebugString(L"Result is false");
				return 0;
			}
		}
	}
	return DefWindowProc(hWnd, msg, wParam, lParam);
}
Exemple #26
0
STDMETHODIMP_(ULONG) CShellExt::Release()
{
    ODS(L"CShellExt::Release()\r\n");

    if (--m_cRef)
        return m_cRef;

    delete this;

    return 0L;
}
Exemple #27
0
STDMETHODIMP_(ULONG) CFindExtension::AddRef()
{
	
    ODS("CFindExtension::AddRef()\r\n");

	char szNum[100];
	wsprintf(szNum,"m_cRef is after this call %d",m_cRef+1);
	DebugMessage(szNum);
    
	return ++m_cRef;
}
STDMETHODIMP_(ULONG) CLocateShellExtension::AddRef()
{
	
    ODS("CShellExt::AddRef()");

	char szNum[100];
	StringCbPrintf(szNum,100,"m_cRef is after this call %d",m_cRef+1);
	DebugMessage(szNum);
    
	return ++m_cRef;
}
Exemple #29
0
LPPACKET DimesPacketAllocatePacket(void)
{

    LPPACKET    lpPacket;
    lpPacket=(LPPACKET)GlobalAllocPtr(GMEM_MOVEABLE | GMEM_ZEROINIT,sizeof(PACKET));
    if (lpPacket==NULL)
    {
        ODS("PacketAllocatePacket: GlobalAlloc Failed\n");
        return NULL;
    }
    return lpPacket;
}
STDMETHODIMP CLocateShellExtension::DoGAKMenu1(HWND hParent,
                                   LPCSTR pszWorkingDir,
                                   LPCSTR pszCmd,
                                   LPCSTR pszParam,
                                   int iShowCmd)
{
    ODS("CShellExt::DoGAKMenu1()");

    MessageBox(hParent, "Menu item 1!", "Shell Extension Sample", MB_OK);

    return NOERROR;
}