//+--------------------------------------------------------------------------- // // Microsoft Windows // Copyright (C) Microsoft Corporation, 2001 // // File: control.cpp // // Contents: Command line wrapper for nlb.exe // // Notes: // // Author: chrisdar // // Created: 6 Apr 2001 // // Change History: // //+--------------------------------------------------------------------------- #include #include #include #include int __cdecl wmain (int argc, PWCHAR argv[]) { // Set up the path+exe to be executed // Note: system32 is the correct directory, even for i64 machines! const wchar_t* pwszPath = L"%systemroot%\\system32\\wlbs.exe"; const DWORD dwPathLen = wcslen(pwszPath); // Get space needed to hold the command line arguments DWORD dwArgSpace = 0; int i = 0; for (i=1; i add 'argc' to length wchar_t* pwszCommand = new wchar_t[dwPathLen + dwArgSpace + argc]; if (NULL == pwszCommand) { printf("Memory allocation failure...exiting\n"); return -1; } // Build up the command line with spaces as token separators wcscpy(pwszCommand, pwszPath); for (i=1; i