Conversation
|
abhijit apte, @saurabh95 Please review this. |
| { | ||
| u16 hash = 0; | ||
|
|
||
| for ( u32 i = 0; i < 6; i++ ) |
There was a problem hiding this comment.
Where are these types u16 and u32 defined?
| // get MAC address | ||
| bool foundMac1 = false; | ||
| struct ifreq* ifr; | ||
| for ( ifr = conf.ifc_req; (s8*)ifr < (s8*)conf.ifc_req + conf.ifc_len; ifr++ ) |
There was a problem hiding this comment.
if the machine has multiple of them, what are we doing here?
There was a problem hiding this comment.
We are going to ignore this scenario @abhijitapte.
| return id; | ||
| } | ||
|
|
||
| std::string GetSystemUniqueID() |
There was a problem hiding this comment.
can we use std::string& as a parameter instead?
There was a problem hiding this comment.
I don't think that is possible as I am returning a local variable here.
| // we just need this for purposes of unique machine id. So any one or two | ||
| // mac's is fine. | ||
|
|
||
| u16 HashMacAddress( u8* mac ) |
There was a problem hiding this comment.
I assume the mac code changes are the same as the ones mentioned for Linux.
|
|
||
| static const int ERR_PID_NOT_FOUND = -9999; // negative int to avoid confusion with real PIDs | ||
|
|
||
| typedef uint8_t u8; |
There was a problem hiding this comment.
nevermind found the type definitions that I was looking for.
|
|
||
| void GetMacHash(u16& mac1, u16& mac2) | ||
| { | ||
| IP_ADAPTER_INFO AdapterInfo[32]; |
| IP_ADAPTER_INFO AdapterInfo[32]; | ||
| DWORD dwBufLen = sizeof(AdapterInfo); | ||
|
|
||
| DWORD dwStatus = GetAdaptersInfo(AdapterInfo, &dwBufLen); |
There was a problem hiding this comment.
Should you consider MIB_IF_TYPE_ETHERNET as listed in the documentation https://msdn.microsoft.com/en-us/library/windows/desktop/aa365917(v=vs.85).aspx
There was a problem hiding this comment.
@abhijitapte Could you elaborate more on this comment?
|
|
||
| PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo; | ||
| mac1 = HasMacAddress(pAdapterInfo); | ||
| if (pAdapterInfo->Next) |
There was a problem hiding this comment.
what should you assign mac2 to in case this condition doesn't hold?
There was a problem hiding this comment.
Actually it is better to initialize this all the ids to 0.
| return hash; | ||
| } | ||
|
|
||
| u16 mask[5] = { 0x4e25, 0xf4a1, 0x5437, 0xab41, 0x0000 }; |
There was a problem hiding this comment.
I think this is used inside Smear method.
|
@abhijitapte I will address the review comments. Thanks for reviewing this PR. Appreciate it! |
|
@abhijitapte I have addressed the review comments. Can you have a look again and tell me if this is OK now? Note: I will be handling the linux change in a different PR. |
|
Raised PR for Linux side @ #607 |
|
LGTM |
|
Thanks for reviewing this PR @abhijitapte |
|
For me on Windows, I cannot build brackets-shell due to |
|
@marcelgerber I am using VS 2015. It seems to be building fine on my system. I will try to build this again in the office on Monday. But thanks for building and letting me know. And good to hear from you after a long time 😁 |
This PR is heavily inspired by https://oroboro.com/unique-machine-fingerprint/ in trying to create a hash out of a system based on various parameters like network interfaces, volume, CPU e.t.c.
Relevant PR on Brackets side: adobe/brackets#13419