private _CommandLineToArgvW ( [ cmdLine, int &numArgs ) : |
||
cmdLine | [ | |
numArgs | int | |
return |
public static string[] CommandLineToArgvW(string cmdLine) { IntPtr intPtr = IntPtr.Zero; string[] result; try { int num = 0; intPtr = NativeMethods._CommandLineToArgvW(cmdLine, out num); if (intPtr == IntPtr.Zero) { throw new Win32Exception(); } string[] array = new string[num]; for (int i = 0; i < num; i++) { IntPtr ptr = Marshal.ReadIntPtr(intPtr, i * Marshal.SizeOf(typeof(IntPtr))); array[i] = Marshal.PtrToStringUni(ptr); } result = array; } finally { IntPtr intPtr2 = NativeMethods._LocalFree(intPtr); } return(result); }