28#if !defined WIN32_LEAN_AND_MEAN
29# define WIN32_LEAN_AND_MEAN
35#include <osl/file.hxx>
36#include <osl/security.hxx>
54 DWORD sz = MAX_COMPUTERNAME_LENGTH + 1;
55 TCHAR szHost[MAX_COMPUTERNAME_LENGTH + 1];
56 if (GetComputerNameA(szHost, &sz))
57 aHost = OString(szHost);
59 aHost = OString(
"UNKNOWN");
64 if ( gethostname( pHostName,
sizeof( pHostName ) - 1 ) == 0 )
66 pHostName[
sizeof( pHostName ) - 1] =
'\0';
67 aHost = OString( pHostName );
70 aHost = OString(
"UNKNOWN");
79 :m_bIPCserver(bIPCserver)
89 const int nIdBytes = 16;
90 char tmpId[nIdBytes*2+1];
91 time_t
t = time(
nullptr);
92 for (
int i = 0;
i<nIdBytes;
i++) {
95 sprintf( tmpId+
i*2,
"%02X", tmpByte );
98 tmpId[nIdBytes*2]=0x00;
99 m_aId = OUString::createFromAscii( tmpId );
102 char *tmpTime = ctime( &
t );
103 if (tmpTime !=
nullptr) {
104 m_aDate = OUString::createFromAscii( tmpTime );
105 sal_Int32
i =
m_aDate.indexOf(
'\n');
113 if (aFile.open( osl_File_OpenFlag_Create ) == File::E_EXIST) {
129 (execWarning !=
nullptr && (*execWarning)(
this ))) {
133 (void)aFile.open( osl_File_OpenFlag_Create );
155 Config aConfig(aLockname);
158 if (!aIPCserver.equalsIgnoreAsciiCase(
"true"))
166 if (aHost == myHost) {
170 aSecurity.getUserName( myUserName );
181 Config aConfig(aLockname);
188 aSecurity.getUserName( aUserName );
void SetGroup(const OString &rGroup)
OString ReadKey(const OString &rKey) const
void WriteKey(const OString &rKey, const OString &rValue)
bool check(fpExecWarning execWarning)
Lockfile(bool bIPCserver=true)
static PathStatus locateUserInstallation(OUString &_rURL)
static OString impl_getHostname()
#define LOCKFILE_STAMPKEY
int uniform_int_distribution(int a, int b)
int sprintf(char(&s)[N], char const *format, T &&... arguments)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
#define SAL_WNODEPRECATED_DECLARATIONS_POP
#define SAL_WNODEPRECATED_DECLARATIONS_PUSH