|
|
Thanks. Been to Wiki and there are 4~5 sample apps in CodeProject as well.
Is Peer-to-Peer file transfer method safe? Or it is as safe (or as vulnerable) as the socket layer underneath it?
The files that need to be transfer between the 2 system requires secure connection by law (medical).
From Wiki, Peer-to-Peer operates differently from client-server model. What is the difference between Peer-to-Peer and cloud computing?
Regards,
S
|
|
|
|
|
seifwen wrote: Is Peer-to-Peer file transfer method safe? Or it is as safe (or as vulnerable) as the socket layer underneath it?
The P2P networking model is only as safe as the underlying transport being used... e.g. use a standard TLS library for secure TCP connections. If properly integrated into your application (automatic certification handling or manual validation, etc), this should be able to fulfil requirements for a medical project.
seifwen wrote: Peer-to-Peer operates differently from client-server model.
Yes, they are pretty much the opposite. In a P2P network every node can be client or server (in theory), information/services can be distributed and provided from multiple sources, no centralised architecture.
seifwen wrote: What is the difference between Peer-to-Peer and cloud computing?
Cloud computing is a buzzword to describe an application/business model with a tendency towards client-server model, as far as I understand. On the other hand, P2P is a technical term to describe a networking model (P2P can be part of a cloud's networking architecture, however not typically used).
Hope those answers helped.
|
|
|
|
|
Thank you very much for your explanations.
|
|
|
|
|
I am enabling my LAN connection using the code:
try
{
bool result = false;
typedef void (__stdcall * LPNcFreeNetconProperties)(NETCON_PROPERTIES* pProps);
HMODULE hmod = LoadLibrary(L"netshell.dll");
if (!hmod)
return false;
LPNcFreeNetconProperties NcFreeNetconProperties = (LPNcFreeNetconProperties)GetProcAddress(hmod, "NcFreeNetconProperties");
if (!NcFreeNetconProperties )
return false;
INetConnectionManager * pMan = 0;
HRESULT hres = CoCreateInstance(CLSID_ConnectionManager,
0,
CLSCTX_ALL,
__uuidof(INetConnectionManager),
(void**)&pMan);
if (SUCCEEDED(hres))
{
IEnumNetConnection * pEnum = 0;
hres = pMan->EnumConnections(NCME_DEFAULT, &pEnum);
if (SUCCEEDED(hres))
{
INetConnection * pCon = 0;
ULONG count;
bool done = false;
while (pEnum->Next(1, &pCon, &count) == S_OK && !done)
{
NETCON_PROPERTIES * pProps = 0;
hres = pCon->GetProperties(&pProps);
if (SUCCEEDED(hres))
{
if (wcscmp(pProps->pszwName,wszName) == 0)
{
if (bEnable)
result = (pCon->Connect() == S_OK);
else
result = (pCon->Disconnect() == S_OK);
done = true;
result=true;
}
NcFreeNetconProperties(pProps);
}
pCon->Release();
}
pEnum->Release();
}
pMan->Release();
}
FreeLibrary(hmod);
return result;
}
The code works fine for winXP but this is not having any effect when I run the same code in win7.
The function returns successfully but there is no effect on my LAN, it remains disabled.
I am not able to figure out where I am committing any mistake.
Thanks and regards,
Manoj
|
|
|
|
|
I've never heard of an Ian connection... Ian, what is this? lol
As to seriously answering the question, sorry, I can't.
|
|
|
|
|
Oops..must be a typing mistake.
|
|
|
|
|
Most likely Windows 7 requires administrator privilege to enable/disable the lan. Try to right-click on your executable and select "Run As Administrator" and see if that helps.
Good luck.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Sorry for my late reply..was out on the weekend.
I am running the code in my administrator account only but no changes to my LAN connection occur after it. It remains disabled.
Thanks,
Manoj
|
|
|
|
|
Just because you logged on with administrator password does not mean the program has administrator pivilege. You need to try by right-clicking on your software as I said before and choose "Run as administrator".
In Windows 7, all users (even Administrators) only run programs with non-admin privilege.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
krmed makes a valid suggestion above.
However I also noticed in the code block:
if (wcscmp(pProps->pszwName,wszName) == 0)
{
if (bEnable)
result = (pCon->Connect() == S_OK);
else
result = (pCon->Disconnect() == S_OK);
done = true;
result=true;
}
you are always setting result = true , which is not correct if your Connect() call has failed.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi Richard
I must have forgotten to comment the
"result=true;"
statement. Thanks for pointing it out.
Well, the problem is the statement:
result = (pCon->Connect() == S_OK);
assigns true to the variable "result" in WinXP account with the privileges to enable/disable the LAN connection
but in case of WIN7 administrator account the value assigned to the variable "result" is false.
There must be some issue with pCon->Connect() function. But I'm not able to figure out why it is not working even in Administrator account in Win7
Thanks and regards,
Manoj
|
|
|
|
|
You should change your code to trap the return value of your Connect() call and then check for the value S_OK . If the reponse is any other value then you should have some indication of why it is failing. Try not to ignore unsuccessful Win32 responses, as you have no idea what is going wrong if you do.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi Richard
I captured the return value of connect() in a local variable and it shows the following message in debug mode:
0x800702e4 the required operation requires elevation.
Can you tell me how to run a function, such as connect() here, in elevated mode ?
I know that an application or any type of file can be run as elevated using ShellExecuteEx(), but how to for a function ?
Thanks and regards,
Manoj
|
|
|
|
|
I don't know of any way to do it for a function; I suggest you just run your application with administrator privileges.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi Richard,
Ok.
By the way, I am already running the application with administrator account so should it make any difference if I run the same application in the same administrator account with "Run as administrator" after right clicking on the application icon ?
Meanwhile, I will try googling for any possible solutions.
Thanks and regards,
Manoj.
|
|
|
|
|
I have come across similar issues myself; my user account is an administrator account but I still need to run some apps as Administrator in order for them to work. Try the right click and "Run as administrator" to see if that resolves the problem. You can also set the application always to run as administrator by changing its manifest properties. Select Properties for the project in Visual Studio, click on Linker -> Manifest File and select "UAC Execution Level". Change the value to whatever option gives administrator privileges and try running it as normal.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi
Run as administrator works fine for administrator account but when I run the application (as administrator) in a guest account, the application seems to change the settings of administrator instead of the guest account and thereby defeating the purpose of the application.
Eg : If I have proxy enabled in Administrator account and running (as administrator) the application in guest account disables the proxy of the administrator.
The behavior seems quite logical since I am asking the application to run as administrator instead of guest and hence use the administrator environment.
So coming back to my very first mail, the problem in guest account is that CoCreateInstance returns E_ACCESSDENIED.
Is there some way to use the function to run with elevated privileges ?
Or is it that COM objects can not be used in a guest account (which I think should not be the case)?
Thanks
Manoj
|
|
|
|
|
manojsaxena_mca wrote: Eg : If I have proxy enabled in Administrator account and running (as administrator) the application in guest account disables the proxy of the administrator.
Sorry, I'm lost here, as far as I know you can run any application with elevated privileges.
manojsaxena_mca wrote: Is there some way to use the function to run with elevated privileges ?
Or is it that COM objects can not be used in a guest account (which I think should not be the case)?
I have not come across this but the elevated privilege should be carried across from the original app to the COM object. I cannot see that Windows could work otherwise.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi Richard
Both of your comments in the previous reply are true, but what I could figure out: "running as administrator" my application in guest account runs the application using the environment (variables etc) of "administrator" account rather than that of the "guest" account. In other words, effectively the application runs as if it is running in administrator account instead of guest.
Hence application made any changes (disabling proxy, in my case) to administrator and not to guest.
Regards,
Manoj
|
|
|
|
|
That is what I would expect to happen. It should be easy to check just by running a cmd shell as adminstrator and see what you get access to.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
How to run a win32 .exe which takes 2 command line perameter with ShellExecute API ?
|
|
|
|
|
Pass both parameters in a single string as the lpParameters argument.
|
|
|
|
|
Look at the ShellExecute Function (Windows)[^] documentation on the MSDN: you have to use the lpParameters argument. Here below is an example:
ShellExecute(NULL, "open", "notepad.exe", "/P myfile.txt", NULL, SW_SHOW);
|
|
|
|
|
This is not working..
I am passing like
CString cmdArg = _T("-x ") + szUpdateFilePath;
::ShellExecute(NULL, _T("open"), szUnZipExePath,cmdArg , NULL, SW_SHOW);
I need to pass like
unzip.exe -x file.zip
Anything wrong?
|
|
|
|