public static unsafe bool CreateUser() { int returnCode = 0, errorCode = 0; string serverName = null; // local machine. Win32.USER_INFO_1 amUser = new Win32.USER_INFO_1(); CreateUserLevel1(ref amUser); LSAUtil lsaUtil = new LSAUtil(LSA_PASSWORD_KEY); lsaUtil.StoreEncryptedString(amUser.usri1_password); returnCode = Win32.NetUserAdd(serverName, 1, ref amUser, errorCode); return(returnCode == Win32.NERR_Success); }
private bool storeConnectString(string[] installArgs) { string connectString = buildConnectString(installArgs, false, true); LSAUtil lsa = new LSAUtil(); try { lsa.StoreEncryptedString(connectString); } catch (System.Exception ex) { throw ex; } return(true); }