Overview of wmi_misc.inc

Public Function Summary

Public functions are intended to be called by the code that imports this library.

Name Summary
wmi_misc_decode_dacl
wmi_misc_decode_group_sid
wmi_misc_decode_owner_sid
wmi_misc_decode_sacl
wmi_misc_localtime
wmi_misc_logicaldiskpartition
wmi_misc_networkadapter
wmi_misc_networkprotocol
wmi_misc_split_res

Public Function Details

wmi_misc_decode_dacl

Named Parameters

sddl

Code

function wmi_misc_decode_dacl(sddl)
{
  if (sddl == NULL)
    return NULL;

  dacl = eregmatch(string:sddl, pattern:"D:.+S:", icase:TRUE);
  dacl = dacl[0] - "S:";

  return dacl;
}


#

		
top

wmi_misc_decode_group_sid

Named Parameters

sddl

Code

function wmi_misc_decode_group_sid(sddl)
{
  if (sddl == NULL)
    return NULL;

  sddl_owner_sid = eregmatch(string:sddl, pattern:"G:[a-zA-Z0-9-]{0,}:", icase:TRUE);
  sddl_owner_sid_code = split(sddl_owner_sid[0], sep:":", keep:0);
  sid_length = strlen(sddl_owner_sid_code[1]);
  sddl_owner_sid_code_cut = substr(sddl_owner_sid_code[1],0,cut=sid_length-2);

  for(i = 0; i >= 0; i++)
  {
    if(sid_codes[i] == NULL)
        break;

    if(sid_codes[i] == sddl_owner_sid_code_cut)
      val = sid_codes[i + 1];

  }
  if (val) return val;
  else return sddl_owner_sid_code_cut;
}

#

		
top

wmi_misc_decode_owner_sid

Named Parameters

sddl

Code

function wmi_misc_decode_owner_sid(sddl)
{
  if (sddl == NULL)
    return NULL;

  sddl_owner_sid = eregmatch(string:sddl, pattern:"O:[a-zA-Z0-9-]{0,}:", icase:TRUE);
  sddl_owner_sid_code = split(sddl_owner_sid[0], sep:":", keep:0);
  sid_length = strlen(sddl_owner_sid_code[1]);
  sddl_owner_sid_code_cut = substr(sddl_owner_sid_code[1],0,cut=sid_length-2);

  for(i = 0; i >= 0; i++)
  {
    if(sid_codes[i] == NULL)
      break;

    if(sid_codes[i] == sddl_owner_sid_code_cut)
      val = sid_codes[i + 1]; 
    
  }
  if (val) return val;
  else return sddl_owner_sid_code_cut;
}


#

		
top

wmi_misc_decode_sacl

Named Parameters

sddl

Code

function wmi_misc_decode_sacl(sddl)
{
  if (sddl == NULL)
    return NULL;

  return eregmatch(string:sddl, pattern:"S:.+", icase:TRUE);
}

# Win32_LocalTime

		
top

wmi_misc_localtime

Named Parameters

handle

Code

function wmi_misc_localtime(handle)
{
  query = 'Select * From Win32_LocalTime';

  timeList = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< timeList) || !timeList){
    return(0);
  }

  return wmi_misc_split_res(List:timeList);
}

# Win32_LogicalDiskToPartition

		
top

wmi_misc_logicaldiskpartition

Named Parameters

handle

Code

function wmi_misc_logicaldiskpartition(handle)
{
  query = 'Select * From Win32_LogicalDiskToPartition';

  parList = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< parList) || !parList){
    return(0);
  }

  return wmi_misc_split_res(List:parList);
}

# Win32_NetworkAdapter

		
top

wmi_misc_networkadapter

Named Parameters

handle

Code

function wmi_misc_networkadapter(handle)
{
  query = 'Select * From Win32_NetworkAdapter';

  adptList = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< adptList) || !adptList){
    return(0);
  }

  return wmi_misc_split_res(List:adptList);
}

# Win32_NetworkProtocol

		
top

wmi_misc_networkprotocol

Named Parameters

handle

Code

function wmi_misc_networkprotocol(handle)
{
  query = 'Select * From Win32_NetworkProtocol';

  protList = wmi_query(wmi_handle:handle, query:query);

  if(("NTSTATUS" >< protList) || !protList){
    return(0);
  }

  return wmi_misc_split_res(List:protList);
}


		
top

wmi_misc_split_res

Named Parameters

List

Code

function wmi_misc_split_res(List)
{
  if(List == NULL){
    return(0);
  }

  List = split(List, "\n", keep:0);
  prop = split(List[0], sep:"|", keep:0);

  for(i=1; i<max_index(List); i++)
  {
    desc = split(List[i], sep:"|", keep:0);
    for(j=0; j<max_index(prop); j++){
      finalList = finalList + '\n' + prop[j] + ' = ' + desc[j];
    }
    finalList = finalList + '\n\n';
  }
  return finalList;
}



#

		
top