If your on windows you generally need a reboot because windows writes the MAC to the registry. You can use something like SMAC to change it. I've got a little tool I put together real fast one day to do MAC changes using code from the forums, its not pretty and doesn't look real slick but it has multi-nic capability and static vs dhcp detection and network detection and it works, if anyone wants it i'll put it up someplace and post a link to it.
Well, rather then posting a link heres the code. Its really nasty looking code actually, meaning its not pretty at all, and may contain a few items that are not even really used. Its actually a result of throwing things together one day to test some stuff out and it sort of evolved into what you see below. Works with WinXP SP2 and Vista. It works, but it was intended for my own use anyway for experimentation and was never intended for distribution. So if it will not offend you too much looking at such uglyness heres the code I used:
Code: Select all
; credit for most of the code goes mainly to AB Klause - thanks - his was nicer looking and i made it look ugly
; also for the various little procedures dealing with hex numbers thanks goes to those that answered my questions about it and posted the answers for me.
; the code in regtunes I forget where it came from but to whoever, the credit goes to them - thanks :)
ImportC "msvcrt.lib"
asctime.l(a.l)
localtime.l(a.l)
strftime.l(a.l,b.l,c.p-ascii,d.l)
EndImport
XIncludeFile "regrutnes.pbi"
Delay(10)
#Testx_Beta = 33
#Nb_MacUnk = 57
#Nb_Valdhx = 15
#Chng_Flag_ran = 1
#Chng_Flag_nic = 2
#Chng_Flag_man = 3
#Changed_Str_1$ = "MAC change was sucessful." +#CRLF$ +"Your new MAC is : "
#Changed_Str_2$ = "Power down modem, re-start computer and"
#Changed_Str_3$ = "power up modem"
#Changed_Str_4$ = "Changes removed. Power down modem,"
#Changed_Str_5$ = "re-start computer and power up modem"
#Changed_Str_6$ = "Changed to manually entered MAC. Power down modem,"
#Changed_Str_7$ = "You did not select an adapter. Please select adapter to change."
#Changed_Str_9$ = "Only ABCDEF and 0123456789 allowed."
#Changed_Str_10$ = "MAC is not correct"
#Changed_Str_11$ = "Must = 12 valid HEX characters"
#Changed_Str_12$ = "Can not = 000000000000 or FFFFFFFFFFFF."
#Changed_Str_13$ = "MAC change failed."
#Changed_Str_14$ = "No changes to remove."
#Infoinstrc_Str$ = "Information and Instructions"
#Nic_DesServ$ = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards"
#Nic_Exists$ = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards"
#sKeyName$ = "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"
#sKeyNamex$ = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}"
#NIC_key$ = "DriverDesc"
#Nas$ = "NetworkAddress"
#adapt_g_x$ = "NetCfgInstanceId"
#Bus_type$ = "BusType"
#Oem_x$ = "InfPath"
#Low_Rng$ = "LowerRange"
#Upr_Rng$ = "UpperRange"
#sKeyName_either$ = "\Ndi\Interfaces"
#sKeyName_NetAdd$ = "\Ndi\params\NetworkAddress"
#Param_Desc$ = "ParamDesc"
#Test_OS_1$ = "For WindowsXP SP2 or Windows Vista only!"
Enumeration 1
#CheckBox_1
#CheckBox_2
#CheckBox_3
#CheckBox_4
#CheckBox_5
#CheckBox_6
#Button_1
#Button_2
#Button_3
#Button_4
#String_1
#Text_1
#Text_2
#Text_3
#Text_4
#Text_5
#Text_6
#Text_7
#Text_8
#Text_9
#Text_10
#Text_11
#Text_12
#Text_13
#Text_14
#Text_15
#Text_16
#Text_17
#Text_DS_1
#Text_DS_2
#Text_DS_3
#Text_DS_4
#Text_DS_5
#Text_DS_6
#Text_Static
#Text_DHCP
#Text_DHCP_2
#Text_Network
#Frame3D_1
#Frame3D_2
#Frame3D_3
#Frame3D_4
#Window_0
#Font_ID_1
#Img_ID_1
#Img_Gad_1
#Menu_item_1
EndEnumeration
Enumeration
#MIB_IF_TYPE_OTHER
#MIB_IF_TYPE_ETHERNET
#MIB_IF_TYPE_TOKENRING
#MIB_IF_TYPE_FDDI
#MIB_IF_TYPE_PPP
#MIB_IF_TYPE_LOOPBACK
#MIB_IF_TYPE_SLIP
EndEnumeration
Global new_mac_x$
#MAX_ADAPTER_NAME_LENGTH=256
#MAX_ADAPTER_DESCRIPTION_LENGTH=128
#MAX_ADAPTER_ADDRESS_LENGTH=8
Structure IP_ADDR_STRING
pNext.l
IpAddress.b[16]
IpMask.b[16]
Context.l
EndStructure
Structure IP_ADAPTER_INFO
pNext.l
ComboIndex.l
AdapterName.b[#MAX_ADAPTER_NAME_LENGTH+4]
Description.b[#MAX_ADAPTER_DESCRIPTION_LENGTH+4]
AddressLength.l
Address.b[#MAX_ADAPTER_ADDRESS_LENGTH]
Index.l
Type.l
DhcpEnabled.l
CurrentIpAddressPTR.l
IpAddressList.IP_ADDR_STRING
GatewayList.IP_ADDR_STRING
DhcpServer.IP_ADDR_STRING
HaveWins.l
PrimaryWinsServer.IP_ADDR_STRING
SecondaryWinsServer.IP_ADDR_STRING
LeaseObtained.l
LeaseExpires.l
EndStructure
Structure MyIP_ADAPTER_INFO
AdapterName.s
Description.s
MACAddress.s
IPAdress.s
DhcpServer.s
EndStructure
Dim Mac_aUnk.s(#Nb_MacUnk)
For k=0 To #Nb_MacUnk
Read Mac_aUnk(k)
Next
;////////////////////////////////////////////
lpVersionInformation.OSVERSIONINFOEX
lpVersionInformation\dwOSVersionInfoSize = SizeOf(OSVERSIONINFOEX)
If GetVersionEx_(@lpVersionInformation)
vers_maj.l = lpVersionInformation\dwMajorVersion
vers_min.l = lpVersionInformation\dwMinorVersion
ver_sp.l = lpVersionInformation\wServicePackMajor
If vers_maj = 5 And vers_min = 1 And ver_sp = 2
WinXPSP2.l = 1
Else
WinXPSP2.l = 0
EndIf
If vers_maj = 6
WinVsta.l = 1
Else
WinVsta.l = 0
EndIf
If WinVsta = 1 Or WinXPSP2 = 1
ymd_x$ = FormatDate("%yyyy%mm%dd", Date())
Else
MessageBox_(#Window_0, #Test_OS_1$, "Minimum Operating System Requirements", #MB_TASKMODAL | #MB_ICONSTOP | #MB_OK)
End
EndIf
EndIf
;///////////////////////////////////////////////
length.l=0
Result=GetAdaptersInfo_(0,@length)
If Result=#ERROR_BUFFER_OVERFLOW And length
*Buffer=AllocateMemory(length)
If *Buffer And GetAdaptersInfo_(*Buffer,@length)=#ERROR_SUCCESS
*ipinfo.IP_ADAPTER_INFO=*Buffer
Global NewList MyIPAdapterList.MyIP_ADAPTER_INFO()
While *ipinfo
Adapter_x_Name$ = PeekS(@*ipinfo\AdapterName,-1,#PB_Ascii)
AddElement(MyIPAdapterList())
nic_index_x$ = Str(*ipinfo\Index)
nic_indx_arp.l = *ipinfo\Index
Debug nic_index_x$
ip_indx.l = *ipinfo\Index
Select *ipinfo\Type
Case #MIB_IF_TYPE_OTHER
Type_OTHER$ = "MIB_IF_TYPE_OTHER"
Case #MIB_IF_TYPE_ETHERNET
Type_ETHERNET$ = "MIB_IF_TYPE_ETHERNET"
Case #MIB_IF_TYPE_TOKENRING
Type_TOKENRING$ = "MIB_IF_TYPE_TOKENRING"
Case #MIB_IF_TYPE_FDDI
Type_FDDI$ = "MIB_IF_TYPE_FDDI"
Case #MIB_IF_TYPE_PPP
Type_PPP$ = "MIB_IF_TYPE_PPP"
Case #MIB_IF_TYPE_LOOPBACK
Type_LOOPBACK$ = "MIB_IF_TYPE_LOOPBACK"
Case #MIB_IF_TYPE_SLIP
Type_SLIP$ = "MIB_IF_TYPE_SLIP"
Default
Type_Unknown$ = "Unknown"
EndSelect
MyIPAdapterList()\AdapterName=PeekS(@*ipinfo\AdapterName,-1,#PB_Ascii)
MyIPAdapterList()\Description=PeekS(@*ipinfo\Description,-1,#PB_Ascii)
MyIPAdapterList()\DhcpServer=PeekS(@*ipinfo\DhcpServer+4,-1,#PB_Ascii)
*iplist.IP_ADDR_STRING=*ipinfo\IpAddressList
While *iplist
MyIPAdapterList()\IPAdress+PeekS(@*iplist\IpAddress,-1,#PB_Ascii)+Chr(13)
*iplist.IP_ADDR_STRING=*iplist\pNext
Wend
*iplist.IP_ADDR_STRING=*ipinfo\GatewayList
While *iplist
*iplist.IP_ADDR_STRING=*iplist\pNext
Wend
If *ipinfo\HaveWins
*iplist.IP_ADDR_STRING=*ipinfo\PrimaryWinsServer
While *iplist
*iplist.IP_ADDR_STRING=*iplist\pNext
Wend
*iplist.IP_ADDR_STRING=*ipinfo\SecondaryWinsServer
While *iplist
*iplist.IP_ADDR_STRING=*iplist\pNext
Wend
EndIf
If *ipinfo\DhcpEnabled
*iplist.IP_ADDR_STRING=*ipinfo\DhcpServer
While *iplist
*iplist.IP_ADDR_STRING=*iplist\pNext
Wend
*Buffer2=AllocateMemory(#MAXCHAR)
If *Buffer2
strftime(*Buffer2,#MAXCHAR,"%d.%m.%Y %H:%M:%S",localtime(@*ipinfo\LeaseObtained))
Lease_got$ = "Lease optained : "+PeekS(*Buffer2,-1,#PB_Ascii)
FreeMemory(*Buffer2)
EndIf
*Buffer2=AllocateMemory(#MAXCHAR)
If *Buffer2
strftime(*Buffer2,#MAXCHAR,"%d.%m.%Y %H:%M:%S",localtime(@*ipinfo\LeaseExpires))
Lease_exp$ = "Lease expires : "+PeekS(*Buffer2,-1,#PB_Ascii)
FreeMemory(*Buffer2)
EndIf
Else
No_DHCPServerEnabled$ = "STATIC IP Configuration"
EndIf
If *ipinfo\AddressLength
mac$=""
For i=0 To *ipinfo\AddressLength-1
If i
mac$+":"
EndIf
byte.b=PeekB(@*ipinfo\Address+i)
If byte>=0
mac$+RSet(Hex(byte),2,"0")
Else
mac$+RSet(Hex(byte+256),2,"0")
EndIf
Next
MyIPAdapterList()\MACAddress=mac$
EndIf
*ipinfo.IP_ADAPTER_INFO=*ipinfo\pNext
Wend
ForEach MyIPAdapterList()
nic_index_x_y.l = ListIndex(MyIPAdapterList())
Nic_Guid_Index$ = MyIPAdapterList()\AdapterName
Adapter_Name_Index$ = MyIPAdapterList()\Description
IP_Addr_Index$ = MyIPAdapterList()\IPAdress
Mac_Index$ = MyIPAdapterList()\MACAddress
DHCP_Index$ = MyIPAdapterList()\DhcpServer
If nic_index_x_y = 0 And Len(Adapter_Name_Index$) > 0
Nic_1$ = Adapter_Name_Index$ : Nic_1_IP$ = IP_Addr_Index$ : Nic_1_Guid$ = Nic_Guid_Index$ : Nic_1_AdapterNr$ = Str(nic_index_x_y+1)
disp_mac_1$ = Mac_Index$
Left_thre$ = Left(Mac_Index$, 8) : Left_x$ = Left(Left_thre$, 2) : Left_y$ = Mid(Left_thre$, 4, 2) : Left_z$ = Right(Left_thre$, 2) : man_use_mac_1$ = Left_x$ + Left_y$ + Left_z$
count_nic_nr1.l = 1
ip_dhcp_x_1$ = DHCP_Index$
adapt_indx_xy_1.l = nic_indx_arp
Else
If nic_index_x_y = 1 And Len(Adapter_Name_Index$) > 0
Nic_2$ = Adapter_Name_Index$ : Nic_2_IP$ = IP_Addr_Index$ : Nic_2_Guid$ = Nic_Guid_Index$ : Nic_2_AdapterNr$ = Str(nic_index_x_y+1)
disp_mac_2$ = Mac_Index$
Left_thre$ = Left(Mac_Index$, 8) : Left_x$ = Left(Left_thre$, 2) : Left_y$ = Mid(Left_thre$, 4, 2) : Left_z$ = Right(Left_thre$, 2) : man_use_mac_2$ = Left_x$ + Left_y$ + Left_z$
count_nic_nr2.l = 1
ip_dhcp_x_2$ = DHCP_Index$
adapt_indx_xy_2.l = nic_indx_arp
Else
If nic_index_x_y = 2 And Len(Adapter_Name_Index$) > 0
Nic_3$ = Adapter_Name_Index$ : Nic_3_IP$ = IP_Addr_Index$ : Nic_3_Guid$ = Nic_Guid_Index$ : Nic_3_AdapterNr$ = Str(nic_index_x_y+1)
disp_mac_3$ = Mac_Index$
Left_thre$ = Left(Mac_Index$, 8) : Left_x$ = Left(Left_thre$, 2) : Left_y$ = Mid(Left_thre$, 4, 2) : Left_z$ = Right(Left_thre$, 2) : man_use_mac_3$ = Left_x$ + Left_y$ + Left_z$
count_nic_nr3.l = 1
ip_dhcp_x_3$ = DHCP_Index$
adapt_indx_xy_3.l = nic_indx_arp
Else
If nic_index_x_y = 3 And Len(Adapter_Name_Index$) > 0
Nic_4$ = Adapter_Name_Index$ : Nic_4_IP$ = IP_Addr_Index$ : Nic_4_Guid$ = Nic_Guid_Index$ : Nic_4_AdapterNr$ = Str(nic_index_x_y+1)
disp_mac_4$ = Mac_Index$
Left_thre$ = Left(Mac_Index$, 8) : Left_x$ = Left(Left_thre$, 2) : Left_y$ = Mid(Left_thre$, 4, 2) : Left_z$ = Right(Left_thre$, 2) : man_use_mac_4$ = Left_x$ + Left_y$ + Left_z$
count_nic_nr4.l = 1
ip_dhcp_x_4$ = DHCP_Index$
adapt_indx_xy_4.l = nic_indx_arp
Else
EndIf :EndIf : EndIf: EndIf
Next
Else
;GetLastError$ = Str(GetLastError_())
EndIf
If *Buffer
FreeMemory(*Buffer)
EndIf
EndIf
count_nic.l = count_nic_nr1 + count_nic_nr2 + count_nic_nr3 + count_nic_nr4
;/////////////////////////////////////
Macro Inst_A
MessageRequester(#Infoinstrc_Str$, #Changed_Str_1$ +new_mac_x$ +#CRLF$ +#Changed_Str_2$ + #CRLF$ +#Changed_Str_3$, #PB_MessageRequester_Ok)
EndMacro
Macro Inst_B
MessageRequester(#Infoinstrc_Str$, #Changed_Str_7$, #PB_MessageRequester_Ok)
EndMacro
Macro Inst_C
MessageRequester(#Infoinstrc_Str$, #Changed_Str_4$ + #CRLF$ +#Changed_Str_5$, #PB_MessageRequester_Ok)
EndMacro
Macro Inst_D
MessageRequester(#Infoinstrc_Str$, #Changed_Str_6$ + #CRLF$ +#Changed_Str_5$, #PB_MessageRequester_Ok)
EndMacro
Macro Inst_E
MessageRequester(#Infoinstrc_Str$, #Changed_Str_10$ +#CRLF$ +#Changed_Str_11$ +#CRLF$ +#Changed_Str_9$ +#CRLF$ +#Changed_Str_12$ , #PB_MessageRequester_Ok)
EndMacro
Macro Inst_F
MessageRequester(#Infoinstrc_Str$, #Changed_Str_13$, #PB_MessageRequester_Ok)
EndMacro
Macro Inst_Fx
MessageRequester("Information", #Changed_Str_14$, #PB_MessageRequester_Ok)
EndMacro
Procedure.l GetNetWorkStatus(Net_IP_X$)
For xk=1 To 4
x_unk_net$ = StringField(Net_IP_X$, xk, ".")
If xk = 1 And Len(x_unk_net$) > 0
ip_part_1$ = x_unk_net$
Else
If xk = 2 And Len(x_unk_net$) > 0
ip_part_2$ = x_unk_net$
Else
If xk = 3 And Len(x_unk_net$) > 0
ip_part_3$ = x_unk_net$
Else
If xk = 4 And Len(x_unk_net$) > 0
ip_part_4$ = x_unk_net$
EndIf
EndIf
EndIf
EndIf
Next xk
If ip_part_1$ = "10"
Net_x1.l = #True
Else
If ip_part_1$ = "169" And ip_part_2$ = "254"
Net_x1.l = #True
Else
If ip_part_1$ = "172" And Val(ip_part_2$) >= 16 And Val(ip_part_2$) <= 31
Net_x1.l = #True
Else
If ip_part_1$ = "192" And ip_part_2$ = "168"
Net_x1.l = #True
EndIf
EndIf
EndIf
EndIf
If Net_x1.l = #True
ProcedureReturn #True
Else
ProcedureReturn #False
EndIf
EndProcedure
Procedure IsHex(hex.s)
For k=1 To Len(hex)
If FindString("0123456789ABCDEF",Mid(hex,k,1),1)=0
ProcedureReturn #False
EndIf
Next
ProcedureReturn #True
EndProcedure
Procedure.s SetMacKeySpot(new_mac_x$, in_guid_unk_xa$)
Global gdwrt_x.l
If Len(new_mac_x$) < 12
MessageRequester("Minor Hiccup", "Please run the tool again.", #PB_MessageRequester_Ok)
End
EndIf
For i=0 To 19
If Len(Str(i)) < 2
sKeyName00xx$ = "000" + Str(i)
Else
sKeyName00xx$ = "00" + Str(i)
EndIf
location_guid$ = Reg_GetValue(#HKEY_LOCAL_MACHINE ,#sKeyName$ + sKeyName00xx$, #adapt_g_x$,"")
Delay(100)
If location_guid$ = in_guid_unk_xa$
gdwrt_x.l = Reg_SetValue(#HKEY_LOCAL_MACHINE, #sKeyName$ + sKeyName00xx$, #Nas$, new_mac_x$, #REG_SZ, "")
Delay(300)
RegCloseKey_(#sKeyNamex$ +sKeyName00xx$)
Delay(300)
Break
Else
If i = 19
Break
EndIf
EndIf
gdwrt_x.l = 0
Next
ProcedureReturn
EndProcedure
Procedure.s ResMacKeySpot(in_adapt_zguid$)
Global gdwrt_y.l
For i=0 To 19
If Len(Str(i)) < 2
sKeyName00xx$ = "000" + Str(i)
Else
sKeyName00xx$ = "00" + Str(i)
EndIf
location_guid$ = Reg_GetValue(#HKEY_LOCAL_MACHINE ,#sKeyName$ + sKeyName00xx$, #adapt_g_x$,"")
Delay(100)
If location_guid$ = in_adapt_zguid$
gdwrt_y.l = Reg_DeleteValue(#HKEY_LOCAL_MACHINE, #sKeyName$ + sKeyName00xx$, #Nas$, "")
Delay(300)
RegCloseKey_(#sKeyNamex$ +sKeyName00xx$)
Delay(300)
Break
Else
If i = 19
Break
EndIf
EndIf
gdwrt_y.l = 0
Next
ProcedureReturn
EndProcedure
Procedure RndNumbx()
Global y_rnd_x.l
For x = 1 To 10
y_rnd_x = Random(245)+10
Repeat
y_rnd_x = Random(245)+10
Until y_rnd_x % 11 <> 0
Next x
ProcedureReturn y_rnd_x
EndProcedure
Procedure RndNumbx_x()
For x = 1 To 10
y_rnd_xx = Random(245)+10
Repeat
y_rnd_xx = Random(245)+10
yrx$ = Hex(y_rnd_xx)
left_yrx$ = Left(yrx$, 1)
rgth_yrx$ = Right(yrx$, 1)
Until y_rnd_xx % 11 <> 0
Next x
ProcedureReturn y_rnd_xx
EndProcedure
Procedure GetNewMacX(Chng_Flag.l, in_New_Left$)
Global rnd_x_a$, rnd_x_b$, rnd_x_c$
chnce.l = Random(9)
If chnce <= 4
For x = 0 To 9
Repeat
rnd_x_a$ = Hex(RndNumbx())
rnd_x_b$ = Hex(RndNumbx())
rnd_x_c$ = Hex(RndNumbx())
Until (Len(rnd_x_a$) = 2 And rnd_x_a$ <> "99" And rnd_x_a$ <> "00") And (Len(rnd_x_b$) = 2 And rnd_x_b$ <> "99" And rnd_x_b$ <> "00") And (Len(rnd_x_c$) = 2 And rnd_x_c$ <> "99" And rnd_x_c$ <> "00")
Next x
Else
For x = 0 To 9
Repeat
rnd_x_a$ = Hex(RndNumbx_x())
rnd_x_b$ = Hex(RndNumbx_x())
rnd_x_c$ = Hex(RndNumbx_x())
Until (Len(rnd_x_a$) = 2 And rnd_x_a$ <> "99" And rnd_x_a$ <> "00") And (Len(rnd_x_b$) = 2 And rnd_x_b$ <> "99" And rnd_x_b$ <> "00") And (Len(rnd_x_c$) = 2 And rnd_x_c$ <> "99" And rnd_x_c$ <> "00")
Next x
EndIf
If Chng_Flag = 1
new_mac_x$ = in_New_Left$ + rnd_x_a$ + rnd_x_b$ + rnd_x_c$
Else
If Chng_Flag = 2
new_mac_x$ = in_New_Left$ + rnd_x_a$ + rnd_x_b$ + rnd_x_c$
EndIf
EndIf
If Len(new_mac_x$) = 12
ret_xx.l = 1
Else
ret_xx.l = 0
MessageRequester("Error", "Problem with generating new MAC", #PB_MessageRequester_Ok)
End
EndIf
ProcedureReturn ret_xx
EndProcedure
Procedure ChgxMAC(Chng_Flag.l, in_fixd_mac_x$, in_nic_get$, in_guid_get$)
chg_name_get$ = in_nic_get$
chg_guid_get$ = in_guid_get$
gnm_x.l = GetNewMacX(Chng_Flag.l, in_fixd_mac_x$)
If gnm_x = 1
SetMacKeySpot(new_mac_x$, chg_guid_get$)
Else
GetNewMacX(Chng_Flag.l, fixd_mac_x$)
EndIf
EndProcedure
If OpenWindow(#Window_0, 0, 0, 600, 500, "Quickly Kludged up ugly MAC Change code", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered) And CreateGadgetList(WindowID(#Window_0))
If CreateMenu(#Menu_item_1, WindowID(#Window_0))
MenuTitle("Help")
MenuItem(1, "Quickly kludged together." +Chr(9)+"")
MenuTitle("About")
MenuItem(2, "Kludged up Mac Change Code." +#CRLF$ +" Not pretty and quickly kludged up." +Chr(9)+"")
EndIf
If Len(Nic_1$) > 0
Nic_1_len_x.l = FindString(Nic_1$, "Controller", 0) : Nic_1_len_y.l = FindString(Nic_1$, "Adapter", 0)
If Nic_1_len_x > 0
Nic_1_disp_name_x$ = Mid(Nic_1$, 0, Nic_1_len_x-1) +"Controller"
Else
If Nic_1_len_y > 0
Nic_1_disp_name_x$ = Mid(Nic_1$, 0, Nic_1_len_y-1) +"Adapter"
Else
Nic_1_disp_name_x$ = Nic_1$
EndIf : EndIf
CheckBoxGadget(#CheckBox_1, 10, 40, 430, 20, Nic_1_disp_name_x$)
TextGadget(#Text_1, 29, 60, 355, 20, "MAC: " +disp_mac_1$ +" IP: " +Nic_1_IP$)
If GetNetWorkStatus(Nic_1_IP$) = #True
SetGadgetColor(#Text_1, #PB_Gadget_FrontColor, RGB($00, $00, $FF))
Else
If GetNetWorkStatus(Nic_1_IP$) = #False And Len(Nic_1_IP$) > 0
SetGadgetColor(#Text_1, #PB_Gadget_FrontColor, RGB($00, $7F, $00))
EndIf : EndIf
Else
CheckBoxGadget(#CheckBox_1, 10, 40, 250, 20, "No Adapter")
TextGadget(#Text_1, 29, 60, 355, 20, "MAC : None IP : None") : SetGadgetColor(#Text_1, #PB_Gadget_FrontColor, RGB($00, $00, $00))
EndIf
If Len(Nic_2$) > 0
Nic_2_len_x.l = FindString(Nic_2$, "Controller", 0) : Nic_2_len_y.l = FindString(Nic_2$, "Adapter", 0)
If Nic_2_len_x > 0
Nic_2_disp_name_x$ = Mid(Nic_2$, 0, Nic_2_len_x-1) +"Controller"
Else
If Nic_2_len_y > 0
Nic_2_disp_name_x$ = Mid(Nic_2$, 0, Nic_2_len_y-1) +"Adapter"
Else
Nic_2_disp_name_x$ = Nic_2$
EndIf : EndIf
CheckBoxGadget(#CheckBox_2, 10, 80, 430, 20, Nic_2_disp_name_x$)
TextGadget(#Text_2, 29, 100, 355, 20, "MAC: " +disp_mac_2$ +" IP: " +Nic_2_IP$) : SetGadgetColor(#Text_2, #PB_Gadget_FrontColor, RGB($00, $00, $FF))
If GetNetWorkStatus(Nic_2_IP$) = #True
SetGadgetColor(#Text_2, #PB_Gadget_FrontColor, RGB($00, $00, $FF))
Else
If GetNetWorkStatus(Nic_2_IP$) = #False And Len(Nic_2_IP$) > 0
SetGadgetColor(#Text_2, #PB_Gadget_FrontColor, RGB($00, $7F, $00))
EndIf : EndIf
Else
CheckBoxGadget(#CheckBox_2, 10, 80, 250, 20, "No Adapter")
TextGadget(#Text_2, 29, 100, 355, 20, "MAC : None IP : None") : SetGadgetColor(#Text_2, #PB_Gadget_FrontColor, RGB($00, $00, $00))
EndIf
If Len(Nic_3$) > 0
Nic_3_len_x.l = FindString(Nic_3$, "Controller", 0) : Nic_3_len_y.l = FindString(Nic_3$, "Adapter", 0)
If Nic_3_len_x > 0
Nic_3_disp_name_x$ = Mid(Nic_3$, 0, Nic_3_len_x-1) +"Controller"
Else
If Nic_3_len_y > 0
Nic_3_disp_name_x$ = Mid(Nic_3$, 0, Nic_3_len_y-1) +"Adapter"
Else
Nic_3_disp_name_x$ = Nic_3$
EndIf : EndIf
CheckBoxGadget(#CheckBox_3, 10, 120, 430, 20, Nic_3_disp_name_x$)
TextGadget(#Text_3, 25, 140, 355, 20, "MAC: " +disp_mac_3$ +" IP: " +Nic_3_IP$) : SetGadgetColor(#Text_3, #PB_Gadget_FrontColor, RGB($00, $00, $FF))
If GetNetWorkStatus(Nic_3_IP$) = #True
SetGadgetColor(#Text_3, #PB_Gadget_FrontColor, RGB($00, $00, $FF))
Else
If GetNetWorkStatus(Nic_3_IP$) = #False And Len(Nic_3_IP$) > 0
SetGadgetColor(#Text_3, #PB_Gadget_FrontColor, RGB($00, $7F, $00))
EndIf : EndIf
Else
CheckBoxGadget(#CheckBox_3, 10, 120, 250, 20, "No Adapter")
TextGadget(#Text_3, 29, 140, 355, 20, "MAC : None IP : None") : SetGadgetColor(#Text_3, #PB_Gadget_FrontColor, RGB($00, $00, $00))
EndIf
If Len(Nic_4$) > 0
Nic_4_len_x.l = FindString(Nic_4$, "Controller", 0) : Nic_4_len_y.l = FindString(Nic_4$, "Adapter", 0)
If Nic_4_len_x > 0
Nic_4_disp_name_x$ = Mid(Nic_4$, 0, Nic_4_len_x-1) +"Controller"
Else
If Nic_4_len_y > 0
Nic_4_disp_name_x$ = Mid(Nic_4$, 0, Nic_4_len_y-1) +"Adapter"
Else
Nic_4_disp_name_x$ = Nic_4$
EndIf : EndIf
CheckBoxGadget(#CheckBox_4, 10, 160, 430, 20, Nic_4_disp_name_x$)
TextGadget(#Text_4, 25, 180, 355, 20, "MAC: " +disp_mac_4$ +" IP: " +Nic_4_IP$) : SetGadgetColor(#Text_4, #PB_Gadget_FrontColor, RGB($00, $00, $FF))
If GetNetWorkStatus(Nic_4_IP$) = #True
SetGadgetColor(#Text_4, #PB_Gadget_FrontColor, RGB($00, $00, $FF))
Else
If GetNetWorkStatus(Nic_4_IP$) = #False And Len(Nic_4_IP$) > 0
SetGadgetColor(#Text_4, #PB_Gadget_FrontColor, RGB($00, $7F, $00))
EndIf : EndIf
Else
CheckBoxGadget(#CheckBox_4, 10, 160, 250, 20, "No Adapter")
TextGadget(#Text_4, 29, 180, 355, 20, "MAC : None IP : None") : SetGadgetColor(#Text_4, #PB_Gadget_FrontColor, RGB($00, $00, $00))
EndIf
ButtonGadget(#Button_1, 449, 50, 140, 30, "Change to Random MAC") : GadgetToolTip(#Button_1, "Click here to change to a Random MAC")
ButtonGadget(#Button_2, 449, 100, 140, 30, "Change Existing NIC MAC") : GadgetToolTip(#Button_2, "Keeps the manufacturer Identification but changes the rest to a random MAC")
ButtonGadget(#Button_3, 449, 150, 140, 30, "Remove Changes") : GadgetToolTip(#Button_3, "Click here to remove changes made by the tool.")
TextGadget(#Text_7, 470, 202, 90, 15, "Manual MAC Entry", #PB_Text_Center)
StringGadget(#String_1,460,220,120,20,"Enter_MAC", #PB_String_UpperCase)
ButtonGadget(#Button_4, 449, 245, 140, 30, "Enter Manual MAC") : GadgetToolTip(#Button_4, "Click here to enter the Manual MAC")
Frame3DGadget(#Frame3D_1, 5, 20, 440, 275, "System Reported Network Interface Card (NIC) " +"( " +Str(count_nic.l) +" total )" )
Frame3DGadget(#Frame3D_2, 442, 20, 155, 275, "MAC Change Option")
Frame3DGadget(#Frame3D_3, 380, 20, 60, 275, "Status")
Frame3DGadget(#Frame3D_4, 5, 205, 377, 90, "Legend")
TextGadget(#Text_Network, 10, 225, 100, 15, "On Network") : SetGadgetColor(#Text_Network, #PB_Gadget_FrontColor, RGB($00, $00, $FF))
TextGadget(#Text_DHCP, 10, 240, 100, 15, "Not On Network") : SetGadgetColor(#Text_DHCP, #PB_Gadget_FrontColor, RGB($00, $7F, $00))
TextGadget(#Text_DHCP_2, 10, 255, 260, 15, "DHCP = NIC IP Address assigned from a DHCP Server") : SetGadgetColor(#Text_DHCP_2, #PB_Gadget_FrontColor, RGB($00, $00, $00))
TextGadget(#Text_Static, 10, 270, 240, 15, "STATIC = NIC has a Static IP Address") : SetGadgetColor(#Text_Static, #PB_Gadget_FrontColor, RGB($FF, $00, $00))
TextGadget(#Text_12, 0, 298, 600, 20, "MADE JUST FOR THE HECK OF IT", #PB_Text_Center | #PB_Text_Border) : SetGadgetColor(#Text_12, #PB_Gadget_BackColor, RGB(255, 0, 0))
TextGadget(#Text_8, 10, 330, 600, 20, " General Instructions and Information:")
TextGadget(#Text_9, 10, 350, 600, 20, " 1: For random MAC - Select adapter on left - click the *Change to Random NIC MAC* button on right - follow instruction.")
TextGadget(#Text_10, 10, 370, 600, 20, " 2: Change NIC MAC - Select adapter on left - click the *Change Existing NIC MAC* button on right - follow instruction.")
TextGadget(#Text_11, 10, 390, 600, 20, " 3: To remove changes - Select adapter on left - click the *Remove Changes* button on right - follow instruction.")
TextGadget(#Text_15, 80, 410, 400, 20, " 4: Only one NIC may be selected at a time.")
TextGadget(#Text_16, 80, 430, 400, 20, " 5: Manual MAC entry - Must use valid hex characters A - F and 0 - 9")
TextGadget(#Text_17, 80, 450, 450, 20, " 6: Manual MAC entry - Must = 12 characters - can not = 000000000000 or FFFFFFFFFFFF")
If ip_dhcp_x_1$ = "255.255.255.255"
TextGadget(#Text_DS_1, 390, 60, 40, 20, "STATIC", #PB_Text_Center) : SetGadgetColor(#Text_DS_1, #PB_Gadget_FrontColor, RGB($FF, $00, $00))
Else
If Len(ip_dhcp_x_1$) = 0
TextGadget(#Text_DS_1, 390, 60, 40, 20, "NONE", #PB_Text_Center)
Else
TextGadget(#Text_DS_1, 390, 60, 40, 20, "DHCP", #PB_Text_Center) : SetGadgetColor(#Text_DS_1, #PB_Gadget_FrontColor, RGB($00, $7F, $00))
EndIf : EndIf
If ip_dhcp_x_2$ = "255.255.255.255"
TextGadget(#Text_DS_2, 390, 100, 40, 20, "STATIC", #PB_Text_Center) : SetGadgetColor(#Text_DS_2, #PB_Gadget_FrontColor, RGB($FF, $00, $00))
Else
If Len(ip_dhcp_x_2$) = 0
TextGadget(#Text_DS_2, 390, 100, 40, 20, "NONE", #PB_Text_Center)
Else
TextGadget(#Text_DS_2, 390, 100, 40, 20, "DHCP", #PB_Text_Center) : SetGadgetColor(#Text_DS_2, #PB_Gadget_FrontColor, RGB($00, $7F, $00))
EndIf : EndIf
If ip_dhcp_x_3$ = "255.255.255.255"
TextGadget(#Text_DS_3, 390, 140, 40, 20, "STATIC", #PB_Text_Center) : SetGadgetColor(#Text_DS_3, #PB_Gadget_FrontColor, RGB($FF, $00, $00))
Else
If Len(ip_dhcp_x_3$) = 0
TextGadget(#Text_DS_3, 390, 140, 40, 20, "NONE", #PB_Text_Center)
Else
TextGadget(#Text_DS_3, 390, 140, 40, 20, "DHCP") : SetGadgetColor(#Text_DS_3, #PB_Gadget_FrontColor, RGB($00, $7F, $00))
EndIf : EndIf
If ip_dhcp_x_4$ = "255.255.255.255"
TextGadget(#Text_DS_4, 390, 180, 40, 20, "STATIC", #PB_Text_Center) : SetGadgetColor(#Text_DS_4, #PB_Gadget_FrontColor, RGB($FF, $00, $00))
Else
If Len(ip_dhcp_x_4$) = 0
TextGadget(#Text_DS_4, 390, 180, 40, 20, "NONE", #PB_Text_Center)
Else
TextGadget(#Text_DS_4, 390, 180, 40, 20, "DHCP") : SetGadgetColor(#Text_DS_4, #PB_Gadget_FrontColor, RGB($00, $7F, $00))
EndIf : EndIf
If LoadFont(#Font_ID_1, "Old English Text MT", 10, #PB_Font_Underline | #PB_Font_HighQuality)
TextGadget(#Text_14, 3, 480, 90, 20, "PB FORUM CODE", #PB_Text_Center )
SetGadgetFont(#Text_14, FontID(#Font_ID_1))
Else
If LoadFont(#Font_ID_1, "Arial", 8, #PB_Font_Underline | #PB_Font_HighQuality)
TextGadget(#Text_14, 3, 480, 50, 20, "PB FORUM CODE", #PB_Text_Center)
SetGadgetFont(#Text_14, FontID(#Font_ID_1))
EndIf
EndIf
Repeat
Event = WaitWindowEvent()
ventType = EventType()
WindowID = EventWindow()
GadgetID = EventGadget()
If Event = #PB_Event_Gadget
Select GadgetID
Case #CheckBox_1
If GetGadgetState(#CheckBox_1) = 1 And Len(Nic_1$) > 0
Gad_Nic_1.l = 1
SetGadgetState(#CheckBox_2, 0) : SetGadgetState(#CheckBox_3, 0) : SetGadgetState(#CheckBox_4, 0)
Else
Gad_Nic_1.l = 0
SetGadgetState(#CheckBox_1, 0)
EndIf
Case #CheckBox_2
If GetGadgetState(#CheckBox_2) = 1 And Len(Nic_2$) > 0
Gad_Nic_2.l = 1
SetGadgetState(#CheckBox_1, 0) : SetGadgetState(#CheckBox_3, 0) : SetGadgetState(#CheckBox_4, 0)
Else
Gad_Nic_2.l = 0
SetGadgetState(#CheckBox_2, 0)
EndIf
Case #CheckBox_3
If GetGadgetState(#CheckBox_3) = 1 And Len(Nic_3$) > 0
Gad_Nic_3.l = 1
SetGadgetState(#CheckBox_1, 0) : SetGadgetState(#CheckBox_2, 0) : SetGadgetState(#CheckBox_4, 0)
Else
Gad_Nic_3.l = 0
SetGadgetState(#CheckBox_3, 0)
EndIf
Case #CheckBox_4
If GetGadgetState(#CheckBox_4) = 1 And Len(Nic_4$) > 0
Gad_Nic_4.l = 1
SetGadgetState(#CheckBox_1, 0) : SetGadgetState(#CheckBox_2, 0) : SetGadgetState(#CheckBox_3, 0)
Else
Gad_Nic_4.l = 0
SetGadgetState(#CheckBox_4, 0)
EndIf
Case #Button_1
If Gad_Nic_1 = 1 And Len(Nic_1$) > 0 : ChgxMAC(#Chng_Flag_ran, Mac_aUnk(Random(#Nb_MacUnk)), Nic_1$, Nic_1_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_A
Else
Inst_F
EndIf
Else
If Gad_Nic_2 = 1 And Len(Nic_2$) > 0 : ChgxMAC(#Chng_Flag_ran, Mac_aUnk(Random(#Nb_MacUnk)), Nic_2$, Nic_2_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_A
Else
Inst_F
EndIf
Else
If Gad_Nic_3 = 1 And Len(Nic_3$) > 0 : ChgxMAC(#Chng_Flag_ran, Mac_aUnk(Random(#Nb_MacUnk)), Nic_3$, Nic_3_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_A
Else
Inst_F
EndIf
Else
If Gad_Nic_4 = 1 And Len(Nic_4$) > 0 : ChgxMAC(#Chng_Flag_ran, Mac_aUnk(Random(#Nb_MacUnk)), Nic_4$, Nic_4_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_A
Else
Inst_F
EndIf
Else
Inst_B : EndIf : EndIf : EndIf : EndIf
Case #Button_2
If Gad_Nic_1 = 1 And Len(Nic_1$) > 0 : ChgxMAC(#Chng_Flag_nic, man_use_mac_1$, Nic_1$, Nic_1_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_A
Else
Inst_F
EndIf
Else
If Gad_Nic_2 = 1 And Len(Nic_2$) > 0 : ChgxMAC(#Chng_Flag_nic, man_use_mac_2$, Nic_2$, Nic_2_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_A
Else
Inst_F
EndIf
Else
If Gad_Nic_3 = 1 And Len(Nic_3$) > 0 : ChgxMAC(#Chng_Flag_nic, man_use_mac_3$, Nic_3$, Nic_3_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_A
Else
Inst_F
EndIf
Else
If Gad_Nic_4 = 1 And Len(Nic_4$) > 0 : ChgxMAC(#Chng_Flag_nic, man_use_mac_4$, Nic_4$, Nic_4_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_A
Else
Inst_F
EndIf
Else
Inst_B : EndIf : EndIf : EndIf : EndIf
Case #Button_3
If Gad_Nic_1 = 1 And Len(Nic_1$) > 0 : ResMacKeySpot(Nic_1_Guid$) : Delay(1)
If gdwrt_y.l = 1
Inst_C
Else
Inst_Fx
EndIf
Else
If Gad_Nic_2 = 1 And Len(Nic_2$) > 0 : ResMacKeySpot(Nic_2_Guid$) : Delay(1)
If gdwrt_y.l = 1
Inst_C
Else
Inst_Fx
EndIf
Else
If Gad_Nic_3 = 1 And Len(Nic_3$) > 0 : ResMacKeySpot(Nic_3_Guid$) : Delay(1)
If gdwrt_y.l = 1
Inst_C
Else
Inst_Fx
EndIf
Else
If Gad_Nic_4 = 1 And Len(Nic_4$) > 0 : ResMacKeySpot(Nic_4_Guid$) : Delay(1)
If gdwrt_y.l = 1
Inst_C
Else
Inst_Fx
EndIf
Else
Inst_B : EndIf : EndIf : EndIf : EndIf
Case #String_1
SetGadgetColor(#String_1,#PB_Gadget_BackColor,RGB($FF, $FF, $00)) : Delay(1)
Case #Button_4
In_Gad_newmac$ = GetGadgetText(#String_1)
If Len(In_Gad_newmac$) <>12 Or IsHex(In_Gad_newmac$) = 0 Or In_Gad_newmac$ = "000000000000" Or In_Gad_newmac$ = "FFFFFFFFFFFF" : Inst_E
Else
If Gad_Nic_1 = 1 And Len(Nic_1$) > 0 : SetMacKeySpot(In_Gad_newmac$, Nic_1_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_D
Else
Inst_F
EndIf
Else
If Gad_Nic_2 = 1 And Len(Nic_2$) > 0 : SetMacKeySpot(In_Gad_newmac$, Nic_2_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_D
Else
Inst_F
EndIf
Else
If Gad_Nic_3 = 1 And Len(Nic_3$) > 0 : SetMacKeySpot(In_Gad_newmac$, Nic_3_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_D
Else
Inst_F
EndIf
Else
If Gad_Nic_4 = 1 And Len(Nic_4$) > 0 : SetMacKeySpot(In_Gad_newmac$, Nic_4_Guid$) : Delay(1)
If gdwrt_x.l = 1
Inst_D
Else
Inst_F
EndIf
Else
Inst_B : EndIf : EndIf : EndIf : EndIf
EndIf
Default
MessageRequester("Information", "Hiccup" +#CRLF$ +"If you see this, I dont know what happened" +#CRLF$ +"try again maybe?", #PB_MessageRequester_Ok)
EndSelect
Delay(1)
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
DataSection
Mac_aUnk:
Data.s "5254AB", "E20C0F", "080089", "080002", "00C0EF"
Data.s "00E098", "00E081", "00E07D", "00E018", "004010"
Data.s "00C04F", "00A0CC", "006008", "0040FF", "0019B9"
Data.s "0010A4", "0004AC", "0000E1", "00A04B", "004027"
Data.s "000214", "0013F7", "001150", "000d88", "000C41"
Data.s "525400", "001310", "00045A", "000625", "001839"
Data.s "000F66", "001217", "0014BF", "0016B6", "001150"
Data.s "00095B", "000FB5", "00146C", "00184D", "000D88"
Data.s "00173F", "0030BD", "000E3B", "00055D", "00177C"
Data.s "000F3D", "001195", "001346", "0015E9", "004001"
Data.s "00179A", "0050BA", "0080C8", "001349", "00E08F"
Data.s "00A0C5", "0004E2", "000BC5"
EndDataSection