34#define DbgP(_x_) NFS41DbgPrint _x_
38#define TRACE_TAG L"[NFS41_NP]"
39#define WNNC_DRIVER( major, minor ) ( major * 0x00010000 + minor )
53 szbuffer[255] = (
TCHAR)0;
102 DbgP((
TEXT(
"OpenSharedMemory: OpenMutex failed\n")));
103 goto OpenSharedMemoryAbort1;
111 if (*phMemory ==
NULL)
114 DbgP((
TEXT(
"OpenSharedMemory: OpenFileMapping failed\n")));
115 goto OpenSharedMemoryAbort2;
122 DbgP((
TEXT(
"OpenSharedMemory: MapViewOfFile failed\n")));
123 goto OpenSharedMemoryAbort3;
128OpenSharedMemoryAbort3:
131OpenSharedMemoryAbort2:
136OpenSharedMemoryAbort1:
208 DbgP((
TEXT(
"StoreConnectionInfo: NextIndex %d, NumResources %d\n"),
216 FreeEntryFound =
TRUE;
237 pNfs41NetResource->
dwScope = lpNetResource->dwScope;
238 pNfs41NetResource->
dwType = lpNetResource->dwType;
239 pNfs41NetResource->
dwDisplayType = lpNetResource->dwDisplayType;
250 lpNetResource->lpRemoteName);
280 DbgP((
L"[aglo] calling CreateFile\n"));
290 DbgP((
L"[aglo] after CreateFile Device Handle\n"));
294 DbgP((
L"[aglo] calling DeviceIoControl\n"));
305 DbgP((
L"#### In except\n"));
307 DbgP((
L"[aglo] returned from DeviceIoControl %08lx\n", rc));
310 DbgP((
L"[aglo] SendTo_NFS41Driver: returning error from DeviceIoctl\n"));
315 DbgP((
L"[aglo] SendTo_NFS41Driver: The DeviceIoctl call succeded\n"));
322 DbgP((
L"[aglo] SendTo_NFS41Driver: error %08lx opening device \n",
Status));
324 DbgP((
L"[aglo] returned from SendTo_NFS41Driver %08lx\n",
Status));
335 DbgP((
L"[aglo] GetNetCaps %d\n", nIndex ));
388 *lpLogonScript =
NULL;
389 DbgP((
L"[aglo] NPLogonNotify: returning WN_SUCCESS\n" ));
403 DbgP((
L"[aglo] NPPasswordChangeNotify: WN_NOT_SUPPORTED\n" ));
436 WCHAR wszScratch[128];
445 DbgP((
L"[aglo] NPAddConnection3('%s', '%s')\n",
446 lpNetResource->lpLocalName, lpNetResource->lpRemoteName ));
447 DbgP((
L"[aglo] username = '%s', passwd = '%s'\n", lpUserName, lpPassword));
453 DbgP((
L"InitializeConnectionInfo failed with %d\n",
Status ));
460 if (
lstrlen(lpNetResource->lpLocalName) < 2 ||
461 lpNetResource->lpLocalName[1] !=
L':') {
466 LocalName[0] = (
WCHAR)
toupper(lpNetResource->lpLocalName[0]);
468 LocalName[2] =
L'\0';
474 if (lpNetResource->lpRemoteName[0] ==
L'\0' ||
475 lpNetResource->lpRemoteName[0] !=
L'\\' ||
476 lpNetResource->lpRemoteName[1] !=
L'\\') {
482 p = lpNetResource->lpRemoteName + 1;
483 ServerName[0] =
L'\\';
492 ServerName[
i] =
p[
i];
493 if (
p[
i] ==
L'\\')
break;
496 ServerName[
i] =
L'\0';
502#ifdef CONVERT_2_UNIX_SLASHES
508 if(
q[
j] ==
L'\0')
break;
509 if (
q[
j] ==
L'\\')
q[
j] =
L'/';
519 if(
q[
j] ==
L'\0')
break;
520 if (
q[
j] ==
L'/')
q[
j] =
L'\\';
526 DbgP((
L"[aglo] Full Connect Name: %s\n", ConnectionName ));
527 DbgP((
L"[aglo] Full Connect Name Length: %d %d\n",
543 DbgP((
L"[aglo] SendTo_NFS41Driver failed with %d\n",
Status));
547 DbgP((
L"[aglo] calling DefineDosDevice\n"));
550 lpNetResource->lpLocalName,
553 DbgP((
L"[aglo] DefineDosDevice failed with %d\n",
Status));
562 DbgP((
L"[aglo] StoreConnectionInfo failed with %d\n",
Status));
568 DbgP((
L"[aglo] NPAddConnection3: status %08X\n",
Status));
589 DbgP((
TEXT(
"NPCancelConnection\n")));
594 (
PVOID)&pSharedMemory);
602 DbgP((
TEXT(
"NPCancelConnection: NextIndex %d, NumResources %d\n"),
610 if (pNetResource->
InUse)
618 DbgP((
TEXT(
"NPCancelConnection: Connection Found:\n")));
630 DbgP((
TEXT(
"NPCancelConnection: SendToMiniRdr returned Status %lx\n"),
Status));
652 DbgP((
TEXT(
"NPCancelConnection: Name %S EntryName %S\n"),
655 DbgP((
TEXT(
"NPCancelConnection: Name Length %d Entry Name Length %d\n"),
658 DbgP((
TEXT(
"NPCancelConnection: Name Length %d Entry Name Length %d\n"),
667 (
PVOID)&pSharedMemory);
686 (
PVOID)&pSharedMemory);
698 if (pNetResource->
InUse)
700 if ( ( (
wcslen(lpLocalName) + 1) *
sizeof(
WCHAR) ==
704 if (*lpBufferSize < pNetResource->RemoteNameLength)
738 DbgP((
L"[aglo] NPOpenEnum\n"));
767 DbgP((
L"[aglo] NPOpenEnum returning Status %lx\n",
Status));
782 ULONG SpaceNeeded = 0;
783 ULONG SpaceAvailable;
791 DbgP((
L"[aglo] NPEnumResource\n"));
793 DbgP((
L"[aglo] NPEnumResource Count Requested %d\n", *lpcCount));
796 SpaceAvailable = *lpBufferSize;
802 (
PVOID)&pSharedMemory);
807 for (
Index = *(
PULONG)hEnum; EntriesCopied < *lpcCount &&
812 if (pNfsNetResource->
InUse)
817 SpaceNeeded += 5 *
sizeof(
WCHAR);
819 if ( SpaceNeeded > SpaceAvailable )
822 DbgP((
L"[aglo] NPEnumResource More Data Needed - %d\n", SpaceNeeded));
823 *lpBufferSize = SpaceNeeded;
828 SpaceAvailable -= SpaceNeeded;
837 StringZone = (
PWCHAR)( (
PBYTE) StringZone - SpaceNeeded );
852 *StringZone++ =
L'A';
853 *StringZone++ =
L'_';
854 *StringZone++ =
L'O';
855 *StringZone++ =
L'K';
856 *StringZone++ =
L'\0';
863 StringZone = (
PWCHAR)( (
PBYTE) StringZone - SpaceNeeded );
872 *lpcCount = EntriesCopied;
875 DbgP((
L"[aglo] NPEnumResource entries returned: %d\n", EntriesCopied));
884 DbgP((
L"[aglo] NPCloseEnum\n"));
895 DbgP((
L"[aglo] NPGetResourceParent: WN_NOT_SUPPORTED\n" ));
906 DbgP((
L"[aglo] NPGetResourceInformation: WN_NOT_SUPPORTED\n" ));
917 DbgP((
L"[aglo] NPGetUniversalName: WN_NOT_SUPPORTED\n" ));
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
BOOL WINAPI DeviceIoControl(IN HANDLE hDevice, IN DWORD dwIoControlCode, IN LPVOID lpInBuffer OPTIONAL, IN DWORD nInBufferSize OPTIONAL, OUT LPVOID lpOutBuffer OPTIONAL, IN DWORD nOutBufferSize OPTIONAL, OUT LPDWORD lpBytesReturned OPTIONAL, IN LPOVERLAPPED lpOverlapped OPTIONAL)
void MarshalConnectionInfo(IN OUT PCONNECTION_INFO Connection)
DWORD InitializeConnectionInfo(IN OUT PCONNECTION_INFO Connection, IN PMOUNT_OPTION_BUFFER Options, OUT LPWSTR *ConnectionName)
void FreeConnectionInfo(IN PCONNECTION_INFO Connection)
#define INVALID_HANDLE_VALUE
#define HeapFree(x, y, z)
GLdouble GLdouble GLdouble GLdouble q
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
#define EXCEPTION_CONTINUE_SEARCH
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ERROR_FILE_NOT_FOUND
#define NFS41_USER_DEVICE_NAME
#define NFS41_DEVICE_NAME
#define IOCTL_NFS41_ADDCONN
#define NFS41_USER_SHARED_MEMORY_NAME
#define NFS41_PROVIDER_NAME_U
#define IOCTL_NFS41_DELCONN
DWORD APIENTRY NPEnumResource(HANDLE hEnum, LPDWORD lpcCount, LPVOID lpBuffer, LPDWORD lpBufferSize)
static DWORD StoreConnectionInfo(IN LPCWSTR LocalName, IN LPCWSTR ConnectionName, IN USHORT ConnectionNameLength, IN LPNETRESOURCE lpNetResource)
DWORD APIENTRY NPGetCaps(DWORD nIndex)
VOID CloseSharedMemory(PHANDLE hMutex, PHANDLE hMemory, PVOID *pMemory)
DWORD APIENTRY NPPasswordChangeNotify(__in LPCWSTR lpAuthentInfoType, __in LPVOID lpAuthentInfo, __in LPCWSTR lpPreviousAuthentInfoType, __in LPVOID lpPreviousAuthentInfo, __in LPWSTR lpStationName, LPVOID StationHandle, DWORD dwChangeInfo)
ULONG _cdecl NFS41DbgPrint(__in LPTSTR Format,...)
ULONG SendTo_NFS41Driver(IN ULONG IoctlCode, IN PVOID InputDataBuf, IN ULONG InputDataLen, IN PVOID OutputDataBuf, IN PULONG pOutputDataLen)
DWORD APIENTRY NPGetUniversalName(LPCWSTR lpLocalPath, DWORD dwInfoLevel, LPVOID lpBuffer, LPDWORD lpBufferSize)
DWORD APIENTRY NPCloseEnum(HANDLE hEnum)
DWORD APIENTRY NPGetResourceParent(LPNETRESOURCE lpNetResource, LPVOID lpBuffer, LPDWORD lpBufferSize)
DWORD APIENTRY NPGetResourceInformation(__in LPNETRESOURCE lpNetResource, __out_bcount(*lpBufferSize) LPVOID lpBuffer, __inout LPDWORD lpBufferSize, __deref_out LPWSTR *lplpSystem)
DWORD APIENTRY NPAddConnection(__in LPNETRESOURCE lpNetResource, __in_opt LPWSTR lpPassword, __in_opt LPWSTR lpUserName)
DWORD APIENTRY NPLogonNotify(__in PLUID lpLogonId, __in PCWSTR lpAuthentInfoType, __in PVOID lpAuthentInfo, __in PCWSTR lpPreviousAuthentInfoType, __in PVOID lpPreviousAuthentInfo, __in PWSTR lpStationName, __in PVOID StationHandle, __out PWSTR *lpLogonScript)
DWORD APIENTRY NPOpenEnum(DWORD dwScope, DWORD dwType, DWORD dwUsage, LPNETRESOURCE lpNetResource, LPHANDLE lphEnum)
DWORD APIENTRY NPGetConnection(__in LPWSTR lpLocalName, __out_bcount(*lpBufferSize) LPWSTR lpRemoteName, __inout LPDWORD lpBufferSize)
DWORD APIENTRY NPCancelConnection(__in LPWSTR lpName, __in BOOL fForce)
DWORD APIENTRY NPAddConnection3(__in HWND hwndOwner, __in LPNETRESOURCE lpNetResource, __in_opt LPWSTR lpPassword, __in_opt LPWSTR lpUserName, __in DWORD dwFlags)
#define WNNC_DRIVER(major, minor)
DWORD OpenSharedMemory(PHANDLE phMutex, PHANDLE phMemory, PVOID *pMemory)
#define NFS41NP_MUTEX_NAME
#define NFS41NP_MAX_DEVICES
#define WNNC_CON_GETCONNECTIONS
#define WNNC_SPEC_VERSION51
#define WNNC_CON_CANCELCONNECTION
#define WNNC_CON_ADDCONNECTION
#define WNNC_CON_ADDCONNECTION3
#define WNNC_SPEC_VERSION
#define WNNC_DRIVER_VERSION
#define _SEH2_GetExceptionCode()
#define _SEH2_EXCEPT(...)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
STRSAFEAPI StringCchCatW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCchVPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat, va_list argList)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
PCONNECTION_BUFFER Buffer
WCHAR LocalName[MAX_PATH]
WCHAR RemoteName[MAX_PATH]
USHORT ConnectionNameLength
WCHAR ConnectionName[MAX_PATH]
INT NumberOfResourcesInUse
NFS41NP_NETRESOURCE NetResources[NFS41NP_MAX_DEVICES]
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex(IN HANDLE hMutex)
_In_ WDFCOLLECTION _In_ ULONG Index
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_ ULONG IoctlCode
#define DDD_NO_BROADCAST_SYSTEM
DWORD WINAPI GetLastError(void)
#define DDD_EXACT_MATCH_ON_REMOVE
#define DDD_RAW_TARGET_PATH
#define DDD_REMOVE_DEFINITION
#define OutputDebugString
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
#define RESOURCE_CONNECTED
#define RESOURCEUSAGE_CONNECTABLE
#define WN_ALREADY_CONNECTED
#define WN_NO_MORE_DEVICES
NETRESOURCEA * LPNETRESOURCE
#define WN_NO_MORE_ENTRIES
#define WNNC_NET_RDR2SAMPLE