1 // TortoiseGit - a Windows shell extension for easy version control
3 // External Cache Copyright (C) 2005 - 2006,2010 - Will Dean, Stefan Kueng
4 // Copyright (C) 2008-2014 - TortoiseGit
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 #include "TGITCache.h"
24 #include "GitStatusCache.h"
25 #include "CacheInterface.h"
28 #include "CrashReport.h"
29 #include "GitAdminDir.h"
33 #include "..\version.h"
34 #include "SmartHandle.h"
35 #include "DllVersion.h"
38 #define GET_X_LPARAM(lp) ((int)(short)LOWORD(lp))
41 #define GET_Y_LPARAM(lp) ((int)(short)HIWORD(lp))
45 #pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
47 #if ENABLE_CRASHHANLDER
48 CCrashReportTGit
crasher(L
"TGitCache " _T(APP_X64_STRING
), TGIT_VERMAJOR
, TGIT_VERMINOR
, TGIT_VERMICRO
, TGIT_VERBUILD
, TGIT_VERDATE
);
51 DWORD WINAPI
InstanceThread(LPVOID
);
52 DWORD WINAPI
PipeThread(LPVOID
);
53 DWORD WINAPI
CommandWaitThread(LPVOID
);
54 DWORD WINAPI
CommandThread(LPVOID
);
55 LRESULT CALLBACK
WndProc(HWND
, UINT
, WPARAM
, LPARAM
);
57 NOTIFYICONDATA niData
;
60 TCHAR szCurrentCrawledPath
[MAX_CRAWLEDPATHS
][MAX_CRAWLEDPATHSLEN
];
61 int nCurrentCrawledpathIndex
= 0;
62 CComAutoCriticalSection critSec
;
64 volatile LONG nThreadCount
= 0;
66 #define PACKVERSION(major,minor) MAKELONG(minor,major)
68 void DebugOutputLastError()
72 FORMAT_MESSAGE_ALLOCATE_BUFFER
|
73 FORMAT_MESSAGE_FROM_SYSTEM
|
74 FORMAT_MESSAGE_IGNORE_INSERTS
,
77 MAKELANGID(LANG_NEUTRAL
, SUBLANG_DEFAULT
), // Default language
85 // Display the string.
86 OutputDebugStringA("TGitCache GetLastError(): ");
87 OutputDebugString((LPCTSTR
)lpMsgBuf
);
88 OutputDebugStringA("\n");
91 LocalFree( lpMsgBuf
);
94 int __stdcall
WinMain(HINSTANCE hInstance
, HINSTANCE
/*hPrevInstance*/, LPSTR
/*lpCmdLine*/, int /*cmdShow*/)
97 CAutoGeneralHandle hReloadProtection
= ::CreateMutex(NULL
, FALSE
, GetCacheMutexName());
99 if ((!hReloadProtection
) || (GetLastError() == ERROR_ALREADY_EXISTS
))
101 // An instance of TGitCache is already running
102 CTraceToOutputDebugString::Instance()(__FUNCTION__
": TGitCache ignoring restart\n");
106 CGitStatusCache::Create();
107 CGitStatusCache::Instance().Init();
109 SecureZeroMemory(szCurrentCrawledPath
, sizeof(szCurrentCrawledPath
));
113 TCHAR szWindowClass
[] = {TGIT_CACHE_WINDOW_NAME
};
115 // create a hidden window to receive window messages.
117 wcex
.cbSize
= sizeof(WNDCLASSEX
);
118 wcex
.style
= CS_HREDRAW
| CS_VREDRAW
;
119 wcex
.lpfnWndProc
= (WNDPROC
)WndProc
;
122 wcex
.hInstance
= hInstance
;
125 wcex
.hbrBackground
= 0;
126 wcex
.lpszMenuName
= NULL
;
127 wcex
.lpszClassName
= szWindowClass
;
129 RegisterClassEx(&wcex
);
130 hWnd
= CreateWindow(TGIT_CACHE_WINDOW_NAME
, TGIT_CACHE_WINDOW_NAME
, WS_CAPTION
, 0, 0, 800, 300, NULL
, 0, hInstance
, 0);
136 if (CRegStdDWORD(_T("Software\\TortoiseGit\\CacheTrayIcon"), FALSE
)==TRUE
)
138 SecureZeroMemory(&niData
,sizeof(NOTIFYICONDATA
));
142 GetShellVersion(&dwMajor
, &dwMinor
);
143 DWORD dwVersion
= PACKVERSION(dwMajor
, dwMinor
);
144 if (dwVersion
>= PACKVERSION(6,0))
145 niData
.cbSize
= sizeof(NOTIFYICONDATA
);
146 else if (dwVersion
>= PACKVERSION(5,0))
147 niData
.cbSize
= NOTIFYICONDATA_V2_SIZE
;
149 niData
.cbSize
= NOTIFYICONDATA_V1_SIZE
;
151 niData
.uID
= TRAY_ID
; // own tray icon ID
153 niData
.uFlags
= NIF_ICON
|NIF_MESSAGE
;
157 (HICON
)LoadImage(hInstance
,
158 MAKEINTRESOURCE(IDI_TGITCACHE
),
160 GetSystemMetrics(SM_CXSMICON
),
161 GetSystemMetrics(SM_CYSMICON
),
164 // set the message to send
165 // note: the message value should be in the
166 // range of WM_APP through 0xBFFF
167 niData
.uCallbackMessage
= TRAY_CALLBACK
;
168 Shell_NotifyIcon(NIM_ADD
,&niData
);
170 if(niData
.hIcon
&& DestroyIcon(niData
.hIcon
))
174 // Create a thread which waits for incoming pipe connections
175 CAutoGeneralHandle hPipeThread
= CreateThread(
176 NULL
, // no security attribute
177 0, // default stack size
179 (LPVOID
) &bRun
, // thread parameter
181 &dwThreadId
); // returns thread ID
185 //OutputDebugStringA("TGitCache: Could not create pipe thread\n");
186 //DebugOutputLastError();
189 else hPipeThread
.CloseHandle();
191 // Create a thread which waits for incoming pipe connections
192 CAutoGeneralHandle hCommandWaitThread
= CreateThread(
193 NULL
, // no security attribute
194 0, // default stack size
196 (LPVOID
) &bRun
, // thread parameter
198 &dwThreadId
); // returns thread ID
200 if (!hCommandWaitThread
)
202 //OutputDebugStringA("TGitCache: Could not create command wait thread\n");
203 //DebugOutputLastError();
208 // loop to handle window messages.
211 BOOL bLoopRet
= GetMessage(&msg
, NULL
, 0, 0);
212 if ((bLoopRet
!= -1)&&(bLoopRet
!= 0))
214 DispatchMessage(&msg
);
220 Shell_NotifyIcon(NIM_DELETE
,&niData
);
221 CGitStatusCache::Destroy();
226 LRESULT CALLBACK
WndProc(HWND hWnd
, UINT message
, WPARAM wParam
, LPARAM lParam
)
234 case WM_LBUTTONDBLCLK
:
235 if (IsWindowVisible(hWnd
))
236 ShowWindow(hWnd
, SW_HIDE
);
238 ShowWindow(hWnd
, SW_RESTORE
);
243 NOTIFYICONDATA SystemTray
;
244 sInfoTip
.Format(_T("TortoiseGit Overlay Icon Server\nCached Directories: %Id\nWatched paths: %d"),
245 CGitStatusCache::Instance().GetCacheSize(),
246 CGitStatusCache::Instance().GetNumberOfWatchedPaths());
248 SystemTray
.cbSize
= sizeof(NOTIFYICONDATA
);
249 SystemTray
.hWnd
= hTrayWnd
;
250 SystemTray
.uID
= TRAY_ID
;
251 SystemTray
.uFlags
= NIF_TIP
;
252 _tcscpy_s(SystemTray
.szTip
, sInfoTip
);
253 Shell_NotifyIcon(NIM_MODIFY
, &SystemTray
);
261 HMENU hMenu
= CreatePopupMenu();
264 InsertMenu(hMenu
, (UINT
)-1, MF_BYPOSITION
, TRAYPOP_EXIT
, _T("Exit"));
265 SetForegroundWindow(hWnd
);
266 TrackPopupMenu(hMenu
, TPM_BOTTOMALIGN
, pt
.x
, pt
.y
, 0, hWnd
, NULL
);
277 HDC hdc
= BeginPaint(hWnd
, &ps
);
279 GetClientRect(hWnd
, &rect
);
280 // clear the background
281 HBRUSH background
= CreateSolidBrush(::GetSysColor(COLOR_WINDOW
));
282 HGDIOBJ oldbrush
= SelectObject(hdc
, background
);
283 FillRect(hdc
, &rect
, background
);
287 AutoLocker
print(critSec
);
288 GetTextExtentPoint32( hdc
, szCurrentCrawledPath
[0], (int)_tcslen(szCurrentCrawledPath
[0]), &fontsize
);
289 for (int i
=nCurrentCrawledpathIndex
; i
<MAX_CRAWLEDPATHS
; ++i
)
291 TextOut(hdc
, 0, line
*fontsize
.cy
, szCurrentCrawledPath
[i
], (int)_tcslen(szCurrentCrawledPath
[i
]));
294 for (int i
=0; i
<nCurrentCrawledpathIndex
; ++i
)
296 TextOut(hdc
, 0, line
*fontsize
.cy
, szCurrentCrawledPath
[i
], (int)_tcslen(szCurrentCrawledPath
[i
]));
300 SelectObject(hdc
,oldbrush
);
302 DeleteObject(background
);
308 WORD wmId
= LOWORD(wParam
);
318 case WM_QUERYENDSESSION
:
320 CTraceToOutputDebugString::Instance()(__FUNCTION__
": WM_QUERYENDSESSION\n");
321 CAutoWriteWeakLock
writeLock(CGitStatusCache::Instance().GetGuard(), 200);
322 CGitStatusCache::Instance().Stop();
331 CTraceToOutputDebugString::Instance()(__FUNCTION__
": WM_CLOSE/DESTROY/ENDSESSION/QUIT\n");
332 CAutoWriteLock
writeLock(CGitStatusCache::Instance().GetGuard());
333 CGitStatusCache::Instance().Stop();
334 CGitStatusCache::Instance().SaveCache();
335 if (message
!= WM_QUIT
)
341 case WM_DEVICECHANGE
:
343 DEV_BROADCAST_HDR
* phdr
= (DEV_BROADCAST_HDR
*)lParam
;
346 case DBT_CUSTOMEVENT
:
348 CTraceToOutputDebugString::Instance()(__FUNCTION__
": WM_DEVICECHANGE with DBT_CUSTOMEVENT\n");
349 if (phdr
->dbch_devicetype
== DBT_DEVTYP_HANDLE
)
351 DEV_BROADCAST_HANDLE
* phandle
= (DEV_BROADCAST_HANDLE
*)lParam
;
352 if (IsEqualGUID(phandle
->dbch_eventguid
, GUID_IO_VOLUME_DISMOUNT
))
354 CTraceToOutputDebugString::Instance()(__FUNCTION__
": Device to be dismounted\n");
355 CAutoWriteLock
writeLock(CGitStatusCache::Instance().GetGuard());
356 CGitStatusCache::Instance().CloseWatcherHandles(phandle
->dbch_hdevnotify
);
358 if (IsEqualGUID(phandle
->dbch_eventguid
, GUID_IO_VOLUME_LOCK
))
360 CTraceToOutputDebugString::Instance()(__FUNCTION__
": Device lock event\n");
361 CAutoWriteLock
writeLock(CGitStatusCache::Instance().GetGuard());
362 CGitStatusCache::Instance().CloseWatcherHandles(phandle
->dbch_hdevnotify
);
367 case DBT_DEVICEREMOVEPENDING
:
368 case DBT_DEVICEQUERYREMOVE
:
369 case DBT_DEVICEREMOVECOMPLETE
:
370 CTraceToOutputDebugString::Instance()(__FUNCTION__
": WM_DEVICECHANGE with DBT_DEVICEREMOVEPENDING/DBT_DEVICEQUERYREMOVE/DBT_DEVICEREMOVECOMPLETE\n");
371 if (phdr
->dbch_devicetype
== DBT_DEVTYP_HANDLE
)
373 DEV_BROADCAST_HANDLE
* phandle
= (DEV_BROADCAST_HANDLE
*)lParam
;
374 CAutoWriteLock
writeLock(CGitStatusCache::Instance().GetGuard());
375 CGitStatusCache::Instance().CloseWatcherHandles(phandle
->dbch_handle
);
379 CAutoWriteLock
writeLock(CGitStatusCache::Instance().GetGuard());
380 CGitStatusCache::Instance().CloseWatcherHandles(INVALID_HANDLE_VALUE
);
389 return DefWindowProc(hWnd
, message
, wParam
, lParam
);
392 //////////////////////////////////////////////////////////////////////////
394 VOID
GetAnswerToRequest(const TGITCacheRequest
* pRequest
, TGITCacheResponse
* pReply
, DWORD
* pResponseLength
)
397 *pResponseLength
= 0;
398 if(pRequest
->flags
& TGITCACHE_FLAGS_FOLDERISKNOWN
)
400 path
.SetFromWin(pRequest
->path
, !!(pRequest
->flags
& TGITCACHE_FLAGS_ISFOLDER
));
404 path
.SetFromWin(pRequest
->path
);
407 CAutoReadWeakLock
readLock(CGitStatusCache::Instance().GetGuard(), 2000);
408 if (readLock
.IsAcquired())
410 CGitStatusCache::Instance().GetStatusForPath(path
, pRequest
->flags
, false).BuildCacheResponse(*pReply
, *pResponseLength
);
414 CStatusCacheEntry entry
;
415 entry
.BuildCacheResponse(*pReply
, *pResponseLength
);
419 DWORD WINAPI
PipeThread(LPVOID lpvParam
)
421 CTraceToOutputDebugString::Instance()(__FUNCTION__
": PipeThread started\n");
422 bool * bRun
= (bool *)lpvParam
;
423 // The main loop creates an instance of the named pipe and
424 // then waits for a client to connect to it. When the client
425 // connects, a thread is created to handle communications
426 // with that client, and the loop is repeated.
433 hPipe
= CreateNamedPipe(
435 PIPE_ACCESS_DUPLEX
, // read/write access
436 PIPE_TYPE_MESSAGE
| // message type pipe
437 PIPE_READMODE_MESSAGE
| // message-read mode
438 PIPE_WAIT
, // blocking mode
439 PIPE_UNLIMITED_INSTANCES
, // max. instances
440 BUFSIZE
, // output buffer size
441 BUFSIZE
, // input buffer size
442 NMPWAIT_USE_DEFAULT_WAIT
, // client time-out
447 //OutputDebugStringA("TGitCache: CreatePipe failed\n");
448 //DebugOutputLastError();
451 continue; // never leave the thread!
454 // Wait for the client to connect; if it succeeds,
455 // the function returns a nonzero value. If the function returns
456 // zero, GetLastError returns ERROR_PIPE_CONNECTED.
457 fConnected
= ConnectNamedPipe(hPipe
, NULL
) ? TRUE
: (GetLastError() == ERROR_PIPE_CONNECTED
);
460 // Create a thread for this client.
461 CAutoGeneralHandle hInstanceThread
= CreateThread(
462 NULL
, // no security attribute
463 0, // default stack size
465 (HANDLE
) hPipe
, // thread parameter
467 &dwThreadId
); // returns thread ID
469 if (!hInstanceThread
)
471 //OutputDebugStringA("TGitCache: Could not create Instance thread\n");
472 //DebugOutputLastError();
473 DisconnectNamedPipe(hPipe
);
474 // since we're now closing this thread, we also have to close the whole application!
475 // otherwise the thread is dead, but the app is still running, refusing new instances
476 // but no pipe will be available anymore.
477 PostMessage(hWnd
, WM_CLOSE
, 0, 0);
480 // detach the handle, since we passed it to the thread
485 // The client could not connect, so close the pipe.
486 //OutputDebugStringA("TGitCache: ConnectNamedPipe failed\n");
487 //DebugOutputLastError();
491 continue; // don't end the thread!
494 CTraceToOutputDebugString::Instance()(__FUNCTION__
": Pipe thread exited\n");
498 DWORD WINAPI
CommandWaitThread(LPVOID lpvParam
)
500 CTraceToOutputDebugString::Instance()(__FUNCTION__
": CommandWaitThread started\n");
501 bool * bRun
= (bool *)lpvParam
;
502 // The main loop creates an instance of the named pipe and
503 // then waits for a client to connect to it. When the client
504 // connects, a thread is created to handle communications
505 // with that client, and the loop is repeated.
512 hPipe
= CreateNamedPipe(
513 GetCacheCommandPipeName(),
514 PIPE_ACCESS_DUPLEX
, // read/write access
515 PIPE_TYPE_MESSAGE
| // message type pipe
516 PIPE_READMODE_MESSAGE
| // message-read mode
517 PIPE_WAIT
, // blocking mode
518 PIPE_UNLIMITED_INSTANCES
, // max. instances
519 BUFSIZE
, // output buffer size
520 BUFSIZE
, // input buffer size
521 NMPWAIT_USE_DEFAULT_WAIT
, // client time-out
526 //OutputDebugStringA("TGitCache: CreatePipe failed\n");
527 //DebugOutputLastError();
530 continue; // never leave the thread!
533 // Wait for the client to connect; if it succeeds,
534 // the function returns a nonzero value. If the function returns
535 // zero, GetLastError returns ERROR_PIPE_CONNECTED.
536 fConnected
= ConnectNamedPipe(hPipe
, NULL
) ? TRUE
: (GetLastError() == ERROR_PIPE_CONNECTED
);
539 // Create a thread for this client.
540 CAutoGeneralHandle hCommandThread
= CreateThread(
541 NULL
, // no security attribute
542 0, // default stack size
544 (HANDLE
) hPipe
, // thread parameter
546 &dwThreadId
); // returns thread ID
550 //OutputDebugStringA("TGitCache: Could not create Command thread\n");
551 //DebugOutputLastError();
552 DisconnectNamedPipe(hPipe
);
554 // since we're now closing this thread, we also have to close the whole application!
555 // otherwise the thread is dead, but the app is still running, refusing new instances
556 // but no pipe will be available anymore.
557 PostMessage(hWnd
, WM_CLOSE
, 0, 0);
560 // detach the handle, since we passed it to the thread
565 // The client could not connect, so close the pipe.
566 //OutputDebugStringA("TGitCache: ConnectNamedPipe failed\n");
567 //DebugOutputLastError();
571 continue; // don't end the thread!
574 CTraceToOutputDebugString::Instance()(__FUNCTION__
": CommandWait thread exited\n");
578 DWORD WINAPI
InstanceThread(LPVOID lpvParam
)
580 CTraceToOutputDebugString::Instance()(__FUNCTION__
": InstanceThread started\n");
581 TGITCacheResponse response
;
582 DWORD cbBytesRead
, cbWritten
;
585 // The thread's parameter is a handle to a pipe instance.
588 InterlockedIncrement(&nThreadCount
);
591 // Read client requests from the pipe.
592 TGITCacheRequest request
;
593 BOOL fSuccess
= ReadFile(
594 hPipe
, // handle to pipe
595 &request
, // buffer to receive data
596 sizeof(request
), // size of buffer
597 &cbBytesRead
, // number of bytes read
598 NULL
); // not overlapped I/O
600 if (! fSuccess
|| cbBytesRead
== 0)
602 DisconnectNamedPipe(hPipe
);
603 CTraceToOutputDebugString::Instance()(__FUNCTION__
": Instance thread exited\n");
604 InterlockedDecrement(&nThreadCount
);
605 if (nThreadCount
== 0)
606 PostMessage(hWnd
, WM_CLOSE
, 0, 0);
610 DWORD responseLength
;
611 GetAnswerToRequest(&request
, &response
, &responseLength
);
613 // Write the reply to the pipe.
614 fSuccess
= WriteFile(
615 hPipe
, // handle to pipe
616 &response
, // buffer to write from
617 responseLength
, // number of bytes to write
618 &cbWritten
, // number of bytes written
619 NULL
); // not overlapped I/O
621 if (! fSuccess
|| responseLength
!= cbWritten
)
623 DisconnectNamedPipe(hPipe
);
624 CTraceToOutputDebugString::Instance()(__FUNCTION__
": Instance thread exited\n");
625 InterlockedDecrement(&nThreadCount
);
626 if (nThreadCount
== 0)
627 PostMessage(hWnd
, WM_CLOSE
, 0, 0);
632 // Flush the pipe to allow the client to read the pipe's contents
633 // before disconnecting. Then disconnect the pipe, and close the
634 // handle to this pipe instance.
636 FlushFileBuffers(hPipe
);
637 DisconnectNamedPipe(hPipe
);
638 CTraceToOutputDebugString::Instance()(__FUNCTION__
": Instance thread exited\n");
639 InterlockedDecrement(&nThreadCount
);
640 if (nThreadCount
== 0)
641 PostMessage(hWnd
, WM_CLOSE
, 0, 0);
645 DWORD WINAPI
CommandThread(LPVOID lpvParam
)
647 CTraceToOutputDebugString::Instance()(__FUNCTION__
": CommandThread started\n");
651 // The thread's parameter is a handle to a pipe instance.
657 // Read client requests from the pipe.
658 TGITCacheCommand command
;
659 BOOL fSuccess
= ReadFile(
660 hPipe
, // handle to pipe
661 &command
, // buffer to receive data
662 sizeof(command
), // size of buffer
663 &cbBytesRead
, // number of bytes read
664 NULL
); // not overlapped I/O
666 if (! fSuccess
|| cbBytesRead
== 0)
668 DisconnectNamedPipe(hPipe
);
669 CTraceToOutputDebugString::Instance()(__FUNCTION__
": Command thread exited\n");
673 switch (command
.command
)
675 case TGITCACHECOMMAND_END
:
676 FlushFileBuffers(hPipe
);
677 DisconnectNamedPipe(hPipe
);
678 CTraceToOutputDebugString::Instance()(__FUNCTION__
": Command thread exited\n");
680 case TGITCACHECOMMAND_CRAWL
:
682 CTGitPath changedpath
;
683 changedpath
.SetFromWin(command
.path
, true);
684 // remove the path from our cache - that will 'invalidate' it.
686 CAutoWriteLock
writeLock(CGitStatusCache::Instance().GetGuard());
687 CGitStatusCache::Instance().RemoveCacheForPath(changedpath
);
689 CGitStatusCache::Instance().AddFolderForCrawling(changedpath
.GetDirectory());
692 case TGITCACHECOMMAND_REFRESHALL
:
694 CAutoWriteLock
writeLock(CGitStatusCache::Instance().GetGuard());
695 CTraceToOutputDebugString::Instance()(_T(__FUNCTION__
) _T(": refresh all\n"));
696 CGitStatusCache::Instance().Refresh();
699 case TGITCACHECOMMAND_RELEASE
:
701 CTGitPath changedpath
;
702 changedpath
.SetFromWin(command
.path
, true);
703 CTraceToOutputDebugString::Instance()(_T(__FUNCTION__
) _T(": release handle for path %s\n"), changedpath
.GetWinPath());
704 CAutoWriteLock
writeLock(CGitStatusCache::Instance().GetGuard());
705 CGitStatusCache::Instance().CloseWatcherHandles(changedpath
);
706 CGitStatusCache::Instance().RemoveCacheForPath(changedpath
);
709 case TGITCACHECOMMAND_BLOCK
:
711 CTGitPath changedpath
;
712 changedpath
.SetFromWin(command
.path
);
713 CTraceToOutputDebugString::Instance()(_T(__FUNCTION__
) _T(": block path %s\n"), changedpath
.GetWinPath());
714 CGitStatusCache::Instance().BlockPath(changedpath
);
717 case TGITCACHECOMMAND_UNBLOCK
:
719 CTGitPath changedpath
;
720 changedpath
.SetFromWin(command
.path
);
721 CTraceToOutputDebugString::Instance()(_T(__FUNCTION__
) _T(": unblock path %s\n"), changedpath
.GetWinPath());
722 CGitStatusCache::Instance().UnBlockPath(changedpath
);
728 // Flush the pipe to allow the client to read the pipe's contents
729 // before disconnecting. Then disconnect the pipe, and close the
730 // handle to this pipe instance.
732 FlushFileBuffers(hPipe
);
733 DisconnectNamedPipe(hPipe
);
734 CTraceToOutputDebugString::Instance()(__FUNCTION__
": Command thread exited\n");