IOCreateSymbolicLink problem

hey guys,
i am a mid-level kernel programmer. I am facing a problem while creating a driver. What i did was that i created a symbolic link to a device using IOCreateSymbolicLink but now i am getting a problem, the symbolic link is created successfully but it is not showing in explorer.
Now i did some research on this topic and found out the i have to send a user mode broadcast to the application which is the explorer, so i found out that it can be accomplished using BroadcastDeviceVolumeChange, i made a win32 application about it but it didnt work, also i found out that this can also be accomplished using SHChangeNotify but i dont know how to use this, Can anyone please help me on this.
Any help would be appreciated.

Haris.

P.S : the BroadcastDeviceVolumeChange is giving below:

In the the main .cpp:

#include “stdafx.h”
#include “DShow.h”

#include <windows.h>
#include <winuser.h>
#include <dbt.h>

#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name

// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
HRESULT BroadcastVolumeDeviceChange(WPARAM notification,WCHAR DriveLetter);

int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
BroadcastVolumeDeviceChange(DBT_DEVICEARRIVAL,L’X’);
return 1;

// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;

// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_DSHOW, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);

// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}

hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_DSHOW);

// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

return (int) msg.wParam;
}

//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage are only necessary if you want this code
// to be compatible with Win32 systems prior to the ‘RegisterClassEx’
// function that was added to Windows 95. It is important to call this function
// so that the application will get ‘well formed’ small icons associated
// with it.
//

HRESULT BroadcastVolumeDeviceChange(WPARAM notification, WCHAR DriveLetter)
{
static PDEV_BROADCAST_VOLUME pMyDevHdr = NULL;
DWORD dwFlag = BSM_ALLCOMPONENTS;
DWORD volumeMask = 1 < (DriveLetter - L’A’);

// Allocate our broadcast header and keep it around (static)
// We have to keep it around because if we post the broadcast the buffers that we
// pass into the broadcast have to stick around after this call returns.
if (NULL == pMyDevHdr)
{
pMyDevHdr = new DEV_BROADCAST_VOLUME;
}

// Initialize our broadcast header
pMyDevHdr->dbcv_devicetype = DBT_DEVTYP_VOLUME;
pMyDevHdr->dbcv_size = sizeof(DEV_BROADCAST_VOLUME);
pMyDevHdr->dbcv_flags = DBTF_NET;
pMyDevHdr->dbcv_unitmask = volumeMask;

// Broadcast the device change notification
BroadcastSystemMessage(BSF_IGNORECURRENTTASK,
&dwFlag,
WM_DEVICECHANGE,
notification,
(LPARAM)pMyDevHdr);

return S_OK;
}

Is this correct???</dbt.h></winuser.h></windows.h>

You should be interfacing with the mount manager who will take care of the refresh for you.

d

debt from my phone

-----Original Message-----
From: xxxxx@yahoo.com
Sent: Saturday, April 16, 2011 12:34 AM
To: Windows System Software Devs Interest List
Subject: [ntdev] IOCreateSymbolicLink problem

hey guys,
i am a mid-level kernel programmer. I am facing a problem while creating a driver. What i did was that i created a symbolic link to a device using IOCreateSymbolicLink but now i am getting a problem, the symbolic link is created successfully but it is not showing in explorer.
Now i did some research on this topic and found out the i have to send a user mode broadcast to the application which is the explorer, so i found out that it can be accomplished using BroadcastDeviceVolumeChange, i made a win32 application about it but it didnt work, also i found out that this can also be accomplished using SHChangeNotify but i dont know how to use this, Can anyone please help me on this.
Any help would be appreciated.

Haris.

P.S : the BroadcastDeviceVolumeChange is giving below:

In the the main .cpp:

#include “stdafx.h”
#include “DShow.h”

#include <windows.h>
#include <winuser.h>
#include <dbt.h>

#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst; // current instance
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name

// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE, int);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
HRESULT BroadcastVolumeDeviceChange(WPARAM notification,WCHAR DriveLetter);

int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
BroadcastVolumeDeviceChange(DBT_DEVICEARRIVAL,L’X’);
return 1;

// TODO: Place code here.
MSG msg;
HACCEL hAccelTable;

// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_DSHOW, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);

// Perform application initialization:
if (!InitInstance (hInstance, nCmdShow))
{
return FALSE;
}

hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_DSHOW);

// Main message loop:
while (GetMessage(&msg, NULL, 0, 0))
{
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}

return (int) msg.wParam;
}

//
// FUNCTION: MyRegisterClass()
//
// PURPOSE: Registers the window class.
//
// COMMENTS:
//
// This function and its usage are only necessary if you want this code
// to be compatible with Win32 systems prior to the ‘RegisterClassEx’
// function that was added to Windows 95. It is important to call this function
// so that the application will get ‘well formed’ small icons associated
// with it.
//

HRESULT BroadcastVolumeDeviceChange(WPARAM notification, WCHAR DriveLetter)
{
static PDEV_BROADCAST_VOLUME pMyDevHdr = NULL;
DWORD dwFlag = BSM_ALLCOMPONENTS;
DWORD volumeMask = 1 < (DriveLetter - L’A’);

// Allocate our broadcast header and keep it around (static)
// We have to keep it around because if we post the broadcast the buffers that we
// pass into the broadcast have to stick around after this call returns.
if (NULL == pMyDevHdr)
{
pMyDevHdr = new DEV_BROADCAST_VOLUME;
}

// Initialize our broadcast header
pMyDevHdr->dbcv_devicetype = DBT_DEVTYP_VOLUME;
pMyDevHdr->dbcv_size = sizeof(DEV_BROADCAST_VOLUME);
pMyDevHdr->dbcv_flags = DBTF_NET;
pMyDevHdr->dbcv_unitmask = volumeMask;

// Broadcast the device change notification
BroadcastSystemMessage(BSF_IGNORECURRENTTASK,
&dwFlag,
WM_DEVICECHANGE,
notification,
(LPARAM)pMyDevHdr);

return S_OK;
}

Is this correct???


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer</dbt.h></winuser.h></windows.h>

i honestly dont know how to perform this doron, could you like point me to the right direction, like provide me with a link or some data on it please?