我已经创建了一个用户定义的函数并执行了。它返回以下错误消息。需要你的支持。
#include <ntddk.h>
#include <wdmsec.h>
#define control_device_object_symbol L"\\?\\cdosym_ssdt"
const GUID ssdt_hook_uuid = { 0xd47bf014L,0x7b37,0x11e7,{0xba,0x6f,0x00,0x0c,0x29,0xf3,0x4e,0xca} };
PDEVICE_OBJECT gdo = NULL;//for IoCreateDeviceSecure use<global device object>
ULONG g_index = 0;
NTSTATUS DriverEntry(PDRIVER_OBJECT driver, PUNICODE_STRING regPath)
{
DbgBreakPoint();
NTSTATUS status;
ULONG i;
ULONG index;
UNICODE_STRING sddl = RTL_CONSTANT_STRING(L"D:P(A;;GA;;;WD)");
UNICODE_STRING control_device_object = RTL_CONSTANT_STRING(L"\\Device\\cdo_ssdt");
UNICODE_STRING control_device_symbol = RTL_CONSTANT_STRING(control_device_object_symbol);
status = IoCreateDeviceSecure(driver, 0, &control_device_object, FILE_DEVICE_UNKNOWN, FILE_DEVICE_SECURE_OPEN, FALSE, &sddl, (LPCGUID)&ssdt_hook_uuid, &gdo);
if (!NT_SUCCESS(status))
{
DbgPrint(" [-] IoCreateDeviceSecure error.\n");
return status;
}
status = IoDeleteSymbolicLink(&control_device_symbol);
status = IoCreateSymbolicLink(&control_device_symbol, &control_device_object);
if (!NT_SUCCESS(status))
{
DbgPrint(" [-] IoCreateSymbolicLink error while status=0x%X.\n",status);
IoDeleteDevice(gdo);
return status;
}
}
错误:
Msg 6522,Level 16,State 2,Line 11发生了.NET Framework错误 在执行用户定义的例程或聚合期间 “SqlFunctValidateUserCred”:System.FormatException:无效长度 对于Base-64 char数组或字符串。 System.FormatException:at System.Convert.FromBase64_Decode(Char * startInputPtr,Int32 inputLength,Byte * startDestPtr,Int32 destLength)at System.Convert.FromBase64CharPtr(Char * inputPtr,Int32 inputLength)
中的字符串密码
在System.Convert.FromBase64String(String s)at System.Web.Helpers.Crypto.VerifyHashedPassword(String hashedPassword, UserDefinedFunctions.SqlFunctValidateUserCred()
答案 0 :(得分:1)
{{3}}:
参数
hashedPassword
类型:System.String
先前计算的RFC 2898哈希值为基本64位编码的字符串。
读取。
答案 1 :(得分:0)
您可以尝试以下操作:
public static void AddUsersToDatabase(string databaseserver, string databasename, string usertobeadded)
{
using (SqlConnection conn =
new SqlConnection("server=" + databaseserver +
"; database=" + databasename +
"; User ID=WPDOMAIN\\spdev; Integrated Security=SSPI; password=Password123;"))
{
conn.Open();
string password = "Password123";
string sql = "CREATE LOGIN " + usertobeadded + " WITH PASSWORD = '" +
password + "'; USE " + databasename + "; CREATE USER " + usertobeadded + " FOR LOGIN " + usertobeadded + ";";
SqlCommand cmd = new SqlCommand(sql);
cmd.ExecuteNonQuery();
conn.Close();
}
}